• 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: Conditionally enable a button based on NSArrayController's selectedObjects?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conditionally enable a button based on NSArrayController's selectedObjects?


  • Subject: Re: Conditionally enable a button based on NSArrayController's selectedObjects?
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 28 Apr 2006 22:01:01 +0200

Oh, by the way:

On 28.4.2006, at 21:31, John Fox wrote:

return ([self selectedObjects] && [[self selectedObjects] count]);

there's no point. Just

return [[self selectedObjects] count]; // practical and pragmatic

or perhaps

return [[self selectedObjects] count]>0; // equal, a bit more intention-revealing

which is more readable and works exactly as well.

OTOH, if you want to be paranoid on whether int and id are actually represented the same way (they are bound to be in practice, though it is not exactly a hard-rock API contract), you would have to be paranoid about BOOL too:

return [self selectedObjects]!=nil && [[self selectedObjects] count] >0; // paranoically superclean
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Conditionally enable a button based on NSArrayController's selectedObjects?
      • From: Mike Abdullah <email@hidden>
References: 
 >Conditionally enable a button based on NSArrayController's selectedObjects? (From: John Fox <email@hidden>)

  • Prev by Date: Re:(no subject) getting an NSUndoManager in an OCUnit test case
  • Next by Date: Re: Getting a NSView pointer from a nib
  • Previous by thread: Re: Conditionally enable a button based on NSArrayController's selectedObjects?
  • Next by thread: Re: Conditionally enable a button based on NSArrayController's selectedObjects?
  • Index(es):
    • Date
    • Thread