Am 12.06.2010 um 23:22 schrieb Kyle Sluder:

> On Sat, Jun 12, 2010 at 2:11 PM, Jochen Moeller <jo.moel...@online.de> 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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to