Re: Getting a reference to an NSMenuItem from another nib?
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