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: Quincey Morris <email@hidden>
- Date: Tue, 3 Aug 2010 13:15:06 -0700
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