IOS delegate proxy mode observer mode communication between different views

Source: Internet
Author: User

delegate, ubiquitous in iOS, nsurlconnection (network requests have), TableView, Connectionview, and other systems comes with common agents. Even, when they write code, randomly beat out the protocol, according to demand, came out a delegate. In fact, it is the specific application of the observer pattern. Basic observer. The same idea is to create an abstract method that is implemented in a specific view controller. The most common practice is to create a singleton pattern, then invoke the object, set the proxy object, and write the specific implementation.

Nsnotification notification Signal Although can achieve the same effect, to achieve different views of the communication between the actual situation or to see business logic needs, for example, change the theme background color, it is best to nsnotification to achieve. (Refer to 4, 5 network source code is to do so).

Well, look at the source code more every day, not behind closed doors.

IOS delegate proxy mode observer mode communication between different views

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.