• 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: object type testing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: object type testing


  • Subject: Re: object type testing
  • From: Boyd Collier <email@hidden>
  • Date: Sun, 7 May 2006 12:53:57 -0700

By chance, when this topic was begun, I was writing some code to handle users make selections in a dialog containing a set of radio buttons and also a bunch of check boxes. My code has a method that gets called whenever the user hits one of these in the dialog. In very abbreviated form, it looks like this:

- (IBAction)doGroupsChecks:(id)sender {

if ([sender isMemberOfClass:[NSMatrix class]]) {
// find out which button was hit by calling [onButton tag] and do appropriate stuff
...
}

if ([sender isMemberOfClass:[NSButton class]]) {
// do stuff to keep track of which check box was hit
...
}
}


In my simple testing, the above seems to work as I expect and has the (small) advantage of not having to worry about mixing up tags used to distinguish different radio buttons in that set with tags used for my check boxes. But having read the various messages on this topic, I'm wondering whether (1) I'm going to get into trouble by using isMemberOfClass, and (2) whether, in my inexperience with cocoa, I'm totally overlooking an entirely different and more straightforward approach.

Boyd
_______________________________________________
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: object type testing
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Re: filling NSImage with binary data from NSData
  • Next by Date: Re: filling NSImage with binary data from NSData
  • Previous by thread: Re: object type testing
  • Next by thread: Re: object type testing
  • Index(es):
    • Date
    • Thread