NSNotification not going through
NSNotification not going through
- Subject: NSNotification not going through
- From: Matt Judy <email@hidden>
- Date: Sat, 19 Jan 2002 15:29:39 -0800
Hi!
I'm trying to use an NSNotification to tell an NSView subclass to redraw
itself for a color change.
Registering the NSView subclass as an observer:
- (id)init
{
if ( self = [super init] ) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(updateColor:)
name:@"backgroundColorChanged"
object:nil];
}
return self;
}
- (void)updateColor:(NSNotification *)aNotification
{
NSLog(@"gotNotification!");
[self display];
}
And posting the notification from the controller (NSObject subclass):
- (IBAction)changeBackgroundColor:(id)sender
{
[[NSNotificationCenter defaultCenter]
postNotificationName:@"backgroundColorChanged"
object:nil];
NSLog(@"Sent backgroundColorChanged notification");
}
The method which posts the notification is being called, but the
updateColor: method of the view is not. Somewhere, the Notification is
not being sent or received properly. I've studied all the
documentation, and I'm at a loss.
Any ideas?
Thanks!
--Matt