Re: NSNotificationCenter: addObserver:selector:name:object: - Specifying a single event
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