Test Test - 4 months ago 14
Objective-C Question

How to add Notification Observer

I am new in programming and I have no more idea of application developing. So, How to add notification observer and how to define, called and remove.


Define Notification Observer:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myAction:) name:@"NOTIFI_OBSER_test" object:nil];

- (void)myAction:(NSNotification *)notif
 NSLog(@"Received Data for Called Notification Observer is :\n %@",notif);


Called Notification Observer:

[[NSNotificationCenter defaultCenter] postNotificationName:@"NOTIFI_OBSER_test" object:@"Pass Value is test"];

and Remove Notification Observer:

[[NSNotificationCenter defaultCenter] removeObserver:self name:@"NOTIFI_OBSER_test" object:nil];