Created by Guo Chai April 16, 2015 21:50:33
Eyes a little pain, eyesight is also in rapid decline, the window of the soul, pay attention to protection!
================================================
Coupling is a measure of a program written by the standard of good or bad?
Coupling is an indicator of the degree of correlation between modules and modules
"High cohesion, low coupling" is the object-oriented programming of core ⼼ mind;
================
The idea of design patterns is important
==================
Target/action design mode:
MyView:
{ //Save object ID _target; Save method SEL _action;} Assign a value to the instance variable _target and _action-(void) AddTarget: (ID) Target action: (SEL) Action;
-(void) AddTarget: (ID) Target action: (SEL) action{ _target = target; _action = action;}
Corresponding to the call in the Touch event response:
[_target performselector:_action WithObject:self.bView];
The corresponding controller:
[MyView addtarget:self Action: @selector (changecolorandposition:)];
and implement the method.
============================================
Agent design mode idea:
The proxy design pattern is to define the proxy first, then define the class properties of the proxy in the view, and then Cotroller follow the protocol to implement the method in the Protocol
and set the Cotroller itself as an agent.
@property (nonatomic,assign) id<myviewdelegate>delegate;
============================================
Gesture Recognizer:
Gestures: a regular touch.
There are seven major categories of gesture recognizers:
The following implements a pinch gesture:
Grip <pre name= "code" class= "OBJC" >// uipinchgesturerecognizer * pinch = [[Uipinchgesturerecognizer alloc] Initwithtarget:self Action: @selector (pinch:)];// //must note here is Self.view instead of self.redview// [Self.view Addgesturerecognizer:pinch];
-(void) Pinch: (Uipinchgesturerecognizer *) pincgest{ self.redView.transform = Cgaffinetransformmakescale ( Pincgest.scale, Pincgest.scale); NSLog (@ "hold Gestures");}
UI development----Target/action Design patterns and proxy design patterns and gesture recognizers