• 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: Getting a reference to an NSMenuItem from another nib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a reference to an NSMenuItem from another nib?


  • Subject: Re: Getting a reference to an NSMenuItem from another nib?
  • From: Andy Lee <email@hidden>
  • Date: Tue, 14 Jun 2005 13:17:04 -0400

On Jun 14, 2005, at 12:47 PM, Sherm Pendley wrote:
If-tables are only necessary if you're comparing strings. If you're comparing integers - such as tags, for instance - you'd use a switch:

-(BOOL) validateMenuItem:(NSMenuItem*)anItem {
    switch([anItem tag]) {
        case 0:
            /* ... */
        case 1:
            /* ... */
        default:
            return YES;
    }
}

I personally think long switch statements are as ugly as long cascading if statements. Either way, I don't mind if they're isolated to a couple of well-known usages like -validateMenuItem:. I also think tags are a little more trouble to maintain than selectors, but I've used both.


--Andy

_______________________________________________
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: Getting a reference to an NSMenuItem from another nib?
      • From: Sherm Pendley <email@hidden>
    • Re: Getting a reference to an NSMenuItem from another nib?
      • From: Bill Bumgarner <email@hidden>
References: 
 >Re: Getting a reference to an NSMenuItem from another nib? (From: "Theodore H. Smith" <email@hidden>)
 >Re: Getting a reference to an NSMenuItem from another nib? (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Core Data complex structure
  • Next by Date: Re: Getting a reference to an NSMenuItem from another nib?
  • Previous by thread: Re: Getting a reference to an NSMenuItem from another nib?
  • Next by thread: Re: Getting a reference to an NSMenuItem from another nib?
  • Index(es):
    • Date
    • Thread