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