Nsnotificationcenter(Notification Center)
"Note" to remove the observer from the Dealloc
Get notification hubs Singleton object
nsnotificationcenter *center=[nsnotificationcenter defaultcenter];
Common methods:1.Registered Observer-(void) Addobserver: (ID) Observer selector: (SEL) Aselector Name: (NSString*) AName object: (ID) AnObject; Parameters:Observer: ViewerAselector: This method is called automatically when a notification is received AName: Message content ("password" to receive notifications) AnObject: Generally forNil2. Send a notification message-(void) Postnotificationname: (NSString*) AName object: (ID) AnObject UserInfo: (nsdictionary*) Auserinfo; Parameters:AName: Who registered the Notification Center, the viewer mode setting this message content, then notify whoAnObject: Transmitted parameters (arbitrary object)Auserinfo: The Transferred dictionary
nsnotification(If the notified person invokes a method with parameters, pass this object over) Common methods: 1. Gets the passed arguments-(ID) object; 2. Get the passed dictionary
-(nsdictionary *) UserInfo;
A simple way to use notification hubs Nsnotificationcenter