• 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: What is the best way to store some kind of identifying string in an interface builder object?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: What is the best way to store some kind of identifying string in an interface builder object?
      • From: Erik Buck <email@hidden>
    • Re: What is the best way to store some kind of identifying string in an interface builder object?
      • From: Graham Cox <email@hidden>
References: 
 >Re: What is the best way to store some kind of identifying string in an interface builder object? (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: Incompatible managed object model versions
  • Next by Date: Re: What is the best way to store some kind of identifying string in an interface builder object?
  • Previous by thread: Re: What is the best way to store some kind of identifying string in an interface builder object?
  • Next by thread: Re: What is the best way to store some kind of identifying string in an interface builder object?
  • Index(es):
    • Date
    • Thread