Re: Delegate & Notification
Re: Delegate & Notification
- Subject: Re: Delegate & Notification
- From: Michael Babin <email@hidden>
- Date: Sun, 15 May 2011 18:47:28 -0500
On May 15, 2011, at 5:31 PM, Bing Li wrote:
> An object, WorkingApp, prints a line and posts a notification as follows.
>
> import "WorkingApp.h"
>
> @implementation WorkingApp
>
> - (void) Print
> {
> NSLog(@"I am doing a tough job!");
> [[NSNotificationCenter defaultCenter] postNotificationName:@"Done"
> object:self];
> }
>
> @end
>
>
> - (void) setUpNotification: (NSString *) notification withSelector:
> (SEL) methodName
> {
> [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self
> selector:methodName name:notification object:nil];
> }
Why are you adding the observer to NSWorkspace's notification center, as opposed to NSNotificationCenter's default center (where you are posting the notification)?
_______________________________________________
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