Notice of ios-design mode

Source: Internet
Author: User

Notification design mode simple and easy to use, is a project if used too much, not conducive to code maintenance, poor readability.

Implementation process:

    [[Nsnotificationcenter Defaultcenter]postnotificationname:@ "notificarions"Object : Self userinfo:dic];

Send a notification, can be in userinfo: here to pass the value,

    [[Nsnotificationcenter defaultcenter]addobserver:self selector: @selector (notificarions:) Name:@ "  Notificarions"object: nil";

Receive notifications, be sure to note that the notification name must be the same.

Finally, do not forget to remove the notification, or to cause a memory leak

    [[Nsnotificationcenter Defaultcenter] removeobserver:self name:@ "notificarions"  Object: nil];

This article GitHub address Https://github.com/zhangkiwi/iOS_SN_NSNotificationCenter

Notice of ios-design mode

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.