Re: What is the best way to store some kind of identifying string in an interface builder object?
Re: What is the best way to store some kind of identifying string in an interface builder object?
- Subject: Re: What is the best way to store some kind of identifying string in an interface builder object?
- From: Graham Cox <email@hidden>
- Date: Fri, 19 Jun 2009 17:23:38 +1000
On 19/06/2009, at 3:59 AM, Erik Buck wrote:
use
[[myBox subviews] makeObjectPerformSelector:@selector(setEnabled:)
withObject:NO];
or similar.
Are you certain that works? 'NO' isn't an object, so I didn't think
you could use -makeObjectsPerformSelector:withObject: in this fashion
- or is there some magic available that isn't mentioned in the docs?
The docs appear to state explicitly that the single argument to the
selector must be type id. However it does seem to compile without
complaint, though I'm not sure why... If this is permitted, does it
work with rects, points, etc?
Alternatively you can use: [[box subviews] setValue:[NSNumber
numberWithBool:NO] forKey:@"enabled"]; since KVC converts to scalars
as needed.
Another problem here is that setEnabled: only works on NSControls or
derivative, not NSViews. So you'd have to be certain that all your
subviews were controls, otherwise it will throw with an unknown
property error when it hits the first non-control view. Or you could
implement -setEnabled for NSView in a category.
--Graham
_______________________________________________
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