Hi,

I read with interest the guidance in a recent thread regarding accessing ivars in -init methods. In a subclass of NSWindow I call [self setBackgroundColor:someColor] even though I don't override that method. This has worked in the wild for about two years, but I wanted to conform to best practice. I tried accessing backgroundColor directly, but the compiler won't let me because that ivar doesn't exist in my subclass. Calling the method on super works, but when I quit my app the debugger started (but failed to load the program after about a minute!).

How should I set the background colour in this situation? Should I override -backgroundColor and -setBackgroundColor: or should I just keep using [self setBackgroundColor:aColor] in my -init?

For your information, -backgroundColor and -setBackgroundColor: are declared in NSWindow.h

Confused.

Ron

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to