• 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: Question on cocoa style: value for (id)sender parameter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on cocoa style: value for (id)sender parameter


  • Subject: Re: Question on cocoa style: value for (id)sender parameter
  • From: Evan Schoenberg <email@hidden>
  • Date: Mon, 24 Jan 2005 15:51:41 -0600


On Jan 24, 2005, at 3:10 PM, Larry Fransson wrote:


On Jan 24, 2005, at 12:24, Matt Gillette wrote:

[aSheet orderOut:NULL]; [aSheet orderOut:self];

Is there any advantage to null/nil versus self? What is the sender variable used for?

There may be occasions, particularly in IBAction methods that you write, where the action taken might depend on what is triggering the action. The sender parameter allows you to figure out what is triggering the action so that you can decide what to do.



And on the other side of the spectrum, I generally use nil when calling my action/notificaiton methods manually so I can distinguish between an invocation I made and invocation made because of user action or because I am an observer for the relevant notification.


-Evan


Larry Fransson
Seattle, WA

_______________________________________________
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


_______________________________________________ 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
References: 
 >Question on cocoa style: value for (id)sender parameter (From: Matt Gillette <email@hidden>)
 >Re: Question on cocoa style: value for (id)sender parameter (From: Larry Fransson <email@hidden>)

  • Prev by Date: Re: Question on cocoa style: value for (id)sender parameter
  • Next by Date: Re: Services and threads... Help!
  • Previous by thread: Re: Question on cocoa style: value for (id)sender parameter
  • Next by thread: Re: Question on cocoa style: value for (id)sender parameter
  • Index(es):
    • Date
    • Thread