• 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: Returns from a sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Returns from a sheet


  • Subject: Re: Returns from a sheet
  • From: Donald Brown <email@hidden>
  • Date: Fri, 03 May 2002 15:03:54 -0500

on 5/3/02 2:47 PM, Esteban Uribe at email@hidden wrote:

> On Friday, May 03, 2002, at 07:35PM, Ondra Cada <email@hidden> wrote:
>
>>
>> On Friday, May 3, 2002, at 07:57 , Esteban Uribe wrote:
>>
>>> You can use [sender isEqualToString:buttonString] on the sender to find
>>> out if its title is OK or Cancel, this is supposed to be faster than
>>> calling [sender isEqualTo:okButton]; where okButton is an outlet to the
>>> OK button.
>>
>> Does not soud as a good idea to me. First, you have to be pretty careful
>> not to break localizability. Second, why not just plain
>>
>> if (sender==okButton) ...
>
> Doh! To think i've been using isEqualTo for over a year. Damnit, I must have
> thought Objective C had some kind of magical objects that needed isEqualTo to
> be called instead of straight pointer comparision...
>
> Ondra, Is there any reason to use isEqualTo then? Or does isEqualTo just call
> return sender==object?
>
> Officially this is the one programming mistake I've made for the longest
> period of time without noticing...

isEqualTo is if you want to compare values. "if (mystr==@"test")" will
never return true, because the pointer to mystr is different than the
pointer to @"test". So, you'd use "if ([mystr isEqualTo:@"test")" to
compare the values.

To check to see if the two pointers are pointing to the same object, if
(sender==okButton) is both fastest and most reliable.

Donald

--
Donald Brown
email@hidden
http://www.eamontales.com

We have met the enemy and he is us - Pogo
_______________________________________________
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.

  • Follow-Ups:
    • Re: Returns from a sheet
      • From: Ondra Cada <email@hidden>
References: 
 >Re: Returns from a sheet (From: Esteban Uribe <email@hidden>)

  • Prev by Date: Re: Returns from a sheet
  • Next by Date: Re: New features in cocoa.mamasam.com
  • Previous by thread: Re: Returns from a sheet
  • Next by thread: Re: Returns from a sheet
  • Index(es):
    • Date
    • Thread