Re: Handling bindings of an NSControl which forward everything to an NSCell?
Re: Handling bindings of an NSControl which forward everything to an NSCell?
- Subject: Re: Handling bindings of an NSControl which forward everything to an NSCell?
- From: Seth Willits <email@hidden>
- Date: Tue, 11 May 2010 12:41:15 -0700
On May 11, 2010, at 12:31 PM, aaron smith wrote:
> Inside of the setter methods it forwards the value to the cell. Here's
> a quick snippet:
>
> @implementation GDScale9Button
> - (void) setCornerSize:(NSSize) _size {
> [[self cell] setCornerSize:_size];
> }
>
> - (void) setUpImage:(NSImage *) _image {
> [[self cell] setUpImage:_image];
> }
>
> - (void) setDownImage:(NSImage *) _image {
> [[self cell] setDownImage:_image];
> }
> @end
>
> Will that still trigger the normal binding behavior?
Yes, assuming you also have -cornerSize, -upImage, -downImage methods on the button and the values returned from those methods are the ones set using the -setXYZ methods on the button. If, for instance, setDownImage: is called on the cell directly from anywhere else, the button's KVO notifications (will/didChangeValueForKey) will not be sent.
And just a quick comment: using _image for a parameter name is very unconventional. The convention is that leading underscores are for class instance variables, and even that isn't "recommended" because Apple apple reserves names identifiers with leading underscores for their own private variable and method names. A lot of people still do it though, because conflicts are rare. The second most popular form is to use a leading m. At any rate, using _ for parameters is odd.
--
Seth Willits
_______________________________________________
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