V. Design pattern gesture recognizer

Source: Internet
Author: User

First,target/action design mode second, the agent design mode (delegate mode)steps to implement the delegate proxy mode:1. Create a protocol protocol file in which to declare the action or event you want to perform2. Introduce the protocol to the file to be implemented through the proxy (in the. h file Declaration, in. m files that need to be completed by proxy)3. Allow the agent (and the party acting on the other person to execute the file) to comply with the agreement (. m file) and implement the corresponding agent event Instance code: Exercise: Let the custom View controller help ChangeView (which is Rootview child view) Complete the transform color event through the agent General Replacement root view settings in APPDELEGATE.Mdelegateviewcontrol.m (top) General layout settings delegateviewcontrol.m (next) Execution of agent events (equivalent to the nanny performing the event) root.h file implementation replaces Delagatecontroller with views, and Changview as its subclass
root.m File Event (where you add Changview as its subclass and layout) changeView.h file (as the owner of the agreement) simply introduce the protocol and declare the event that the agent will performchangeview.m file (notifies agent of event execution)colorprotocol.h (protocol), declaring a method that requires proxy implementationthird,Uiimageview Four, gesture recognizer

V. Design pattern gesture recognizer

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.