• 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: Dereferencing a pointer in ObjC?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dereferencing a pointer in ObjC?


  • Subject: Re: Dereferencing a pointer in ObjC?
  • From: j o a r <email@hidden>
  • Date: Mon, 29 Jul 2002 09:44:35 +0200

On Monday, July 29, 2002, at 09:27 , Terry Simons wrote:

Is this bad style? Should I be using some NSString comparison method instead?

Try:

[[[myRadioMatrix selectedCell] title] isEqualToString: @"Red"];

Also, The above code is basically checking the name of the radio button in an NSMatrix to see which button is currently selected. Is there a better way to do such checks? It seems to me that the simplest way would be to grab the name of the radio button, because that's a known value to me.

You should probably use tags instead (see "tag / setTag:" in either NSButton / NSCell). Comparing to the title of the cell would break if you would ever choose to change the title because of a misspelling, for a localization, et.c. - it's better to use an identifier that's only an identifier and not part of the UI.

j o a r
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Dereferencing a pointer in ObjC? (From: Terry Simons <email@hidden>)

  • Prev by Date: application terminate, so what about memory...
  • Next by Date: Re: Dereferencing a pointer in ObjC?
  • Previous by thread: Re: Dereferencing a pointer in ObjC?
  • Next by thread: Re: Dereferencing a pointer in ObjC?
  • Index(es):
    • Date
    • Thread