- (void)viewDidDisappear:(BOOL)animated
{[[NSNotificationCenter defaultCenter] removeObserver:self];
[super viewDidDisappear: animated];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear: animated];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNotification:) name:@"Notification" object:nil];
}
- (void) receiveNotification:(NSNotification *) notification
{
// Do something
}
Somewhere in another class
[[NSNotificationCenter defaultCenter] postNotificationName:@"Notification" object:self];
No hay comentarios:
Publicar un comentario