IOS Transfer Value Summary __ios

Source: Internet
Author: User
Tags notification center

Http://www.360doc.com/content/14/0410/21/11029609_367858753.shtml

1, the property transfer value before the value.
2. Protocol Transfer value

3, block transfer value instead of the Protocol agent transfer value, the main point of time.

4, simple transfer value data sharing.

5, the notification transfer value

Notification Center
Nsnotificationcenter provides a more decoupled approach. The most typical application is the notification that any object can send notifications to the center, while any object can listen to the center.
The code to send notifications is as follows:

[[Nsnotificationcenterdefaultcenter] postnotificationname:@ "Mynotificationname" object:broadcasterobject];
The code for registering to receive notifications is as follows:

[[Nsnotificationcenterdefaultcenter] Addobserver:listenerobject selector: @selector (receivingmethodonlistener:) name:@ "Mynotificationname" object:nil];
You can specify a specific broadcaster object when registering for a notification, but this is not required. You may have noticed the defaultcenter. In fact, this is the only center you will use in your application. Notifications are open to the entire application, so there is only one center.
There is also a nsdistributednotificationcenter. This is used for communication between applications. There is only one center of that type on the entire computer.
Advantages: The sender and recipient of the notification do not need to know each other. You can specify a specific way to receive notifications. The notification name can be any string.
Disadvantage: More code is needed to observe the key value. You must remove the listener before you delete it. You can't pass a lot of numbers, just let someone do something.




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.