How to Use nsicationicationcenter in the notification center

Source: Internet
Author: User
Tags notification center

How to Use nsicationicationcenter in the notification center
NSNotificationCenter(Notification center)
 Note]The observer needs to be removed from dealloc. Obtain the notification center singleton object

Nsicationicationcenter * center = [NSNotificationCenter defacenter center];

Common Methods: 1. register the observer-(void) addObserver :( id) observer selector :( SEL) aSelector name :( NSString *) aName object :( id) anObject; parameter: observer aSelector: this method is automatically called when a notification is received. aName: the message content (the "digit" of the notification to be received) anObject: generally nil 2. send notification message-(void) postNotificationName :( NSString *) aName object :( id) anObject userInfo :( NSDictionary *) aUserInfo; parameter: aName: who registered the notification center, when this message content is set in observer mode, anObject is notified: The Transmitted parameter (any object) aUserInfo: The transmitted dictionary. NSNotification(If a parameter is included in the method called by the notification, this object is passed.) Common Methods: 1. Obtain the passed parameter-(id) object; 2. Obtain the passed dictionary.

-(NSDictionary *) userInfo;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.