• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Interference of a variable name with Interface Builder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interference of a variable name with Interface Builder


  • Subject: Re: Interference of a variable name with Interface Builder
  • From: Jochen Moeller <email@hidden>
  • Date: Sun, 13 Jun 2010 00:08:27 +0200

Am 12.06.2010 um 23:22 schrieb Kyle Sluder:

> On Sat, Jun 12, 2010 at 2:11 PM, Jochen Moeller <email@hidden> wrote:
>>
>> Normally variable names don't interfere with method names.
>
> Strictly speaking, Variable names can never interfere with method
> names. The compiler determines the type it needs from context, and
> then resolves the symbol. There is no instance in which either a
> method or a variable name can be used.
>
>>
>> Now, in an app the -drawRect: method of my custom view was not called although it should. I found out that the culprit was an outlet named "alphaValue" which is also an NSView method.
>
> The nib-loading machinery will call KVC-compliant accessors when
> unfreezing a nib. Since NSView is KVC-compliant for the key
> "alphaValue", the nib loading machinery will call -setAlphaValue: with
> your text field as an argument.
>
> So this bug is your responsibility; you have overloaded a term with an
> existing meaning. The solution is to rename your outlet.
>

Kyle, thanks for the insight. Renaming the outlet was also my solution.

Does that mean that an outlet can be invalidated by a future version of a class which introduces a new method with accidentally the same name?

Thanks
Jochen Moeller

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Interference of a variable name with Interface Builder
      • From: Kyle Sluder <email@hidden>
References: 
 >Interference of a variable name with Interface Builder (From: Jochen Moeller <email@hidden>)
 >Re: Interference of a variable name with Interface Builder (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Interference of a variable name with Interface Builder
  • Next by Date: Re: Interference of a variable name with Interface Builder
  • Previous by thread: Re: Interference of a variable name with Interface Builder
  • Next by thread: Re: Interference of a variable name with Interface Builder
  • Index(es):
    • Date
    • Thread