Re: Using NSNotificationCenter passing an object or value?
Re: Using NSNotificationCenter passing an object or value?
- Subject: Re: Using NSNotificationCenter passing an object or value?
- From: eric dolecki GMail <email@hidden>
- Date: Tue, 3 Aug 2010 16:50:59 -0400
Many thanks. I didn't know object could be nil yet still pass it along when populated
On Aug 3, 2010, at 4:15 PM, Quincey Morris <email@hidden> wrote:
> On Aug 3, 2010, at 13:00, Eric E. Dolecki wrote:
>
>> WHen you say it takes an NSNotification object as a parameter, you mean to say that it's missing, correct?
>
> Yes, as in:
>
> - (id)initWithFrame:(CGRect)frame {
> if ((self = [super initWithFrame:frame])) {
> mydata = [[NSArray alloc] init];
> menuItems = [[NSMutableArray alloc] initWithCapacity:40];
> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(buttonClicked:) name:@"ButtonClicked" object:nil];
> // note the colon in the selector now
> }
> return self;
> }
>
> -(void) buttonClicked: (NSNotification*) notification {
> UIButton* button = notification.object;
> NSUInteger tag = button.tag;
> }
> _______________________________________________
>
> 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
_______________________________________________
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