• 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: NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event


  • Subject: Re: NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 27 May 2008 21:00:53 -0700


On 27 May '08, at 12:06 PM, Ari Black wrote:

NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(Quit:) name:NSApplicationWillTerminateNotification object:NSApp];


I have defined Quit: on my main object, so I pass self as the first argument.

This is, functionally, correct.

However, the method should be named "quit:", not "Quit:". Objective-C coding style almost always uses lower-case method names. The only exceptions I've seen are ones where the initial word of the name is an acronym that looks awkward when lowercased, e.g. accessors named "URL" or "MIMEType".

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event
      • From: Andreas Mayer <email@hidden>
References: 
 >NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event (From: Ari Black <email@hidden>)

  • Prev by Date: Re: Question concerning mouseDragged events.
  • Next by Date: Re: Alert Sheets hard wired in Interface Builder
  • Previous by thread: NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event
  • Next by thread: Re: NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event
  • Index(es):
    • Date
    • Thread