Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are all the types of NSNotifications?

Do you know of a comprehensive list of all possible NSNotifications? Please let me know. Thanks.

like image 606
m0rtimer Avatar asked Feb 22 '11 01:02

m0rtimer


2 Answers

That's not a very helpful answer, IMHO - lots of notifications are hard to find, and some are undocumented.

When I need to see what's actually there, I use something like this:

// inside your Application Delegate / main method / similar:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onNotification:) name:nil object:nil];

-(void)onNotification:(NSNotification*)notification
{
NSLog(@"Notification name is %@ sent by %@",[notification name], [[notification object] description] );
}
like image 151
Adam Avatar answered Sep 19 '22 23:09

Adam


A notification name can be any arbitrary string, so the number of possible notifications is effectively unlimited. The documentation for most classes will list the notifications they are guaranteed to send at given times.

like image 39
Chuck Avatar answered Sep 21 '22 23:09

Chuck