简体   繁体   中英

What are all the types of NSNotifications?

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

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] );
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM