A simple way to use notification hubs Nsnotificationcenter

Source: Internet
Author: User
Tags notification center

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

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.