1. nsnotification: message or notification
Three member variables
-(Nsstring*) Name;
-(ID) Object;
-(Nsdictionary*) Userinfo;
Notification name: Name,
Message sender: object. The proxy can receive the nsnotification method.Callback to object
Additional information: userinfo
2. nsicationicationcenter: Message Center
In Singleton mode, you must use the following methods to access
[Nsnotificationcenter defacenter center]
3. broadcast a notification
[[Nsicationcenter center defacenter center] postnotificationname:@"Aevent" Object: Nil];
Send a notification with the accompanying information
[[Nsicationcenter center defacenter center] postnotificationname:@"Event" Object: Nil userinfo :( nsdictionary *) auserinfo];
Auserinfo is a dictionary
Send a notification directly
[[Nsicationcenter center defacenter center] postnotification :( nsnotification *) Notification];
4. Register a notification listener
[[Nsicationcenter center defacenter center] addobserver: Self selector: @ selector (onhandler :) name:@"Aevent" Object: Nil];
When registering a notification, you can specify a specific broadcaster object, but it is not required.
5. Remove a listener
[[Nsicationcenter center defacenter center] removeobserver: Self Name:@"Aevent" Object: Nil];
6. Notify the method to be called
-(Void) Onhandler :( nsnotification *) notif
{
Nsdictionary * user_info = [notif userinfo];
//Execute custom Logic
}