69         //??? UIView ????? view ???е????
 70         [UIView animateWithDuration:slideFactor*2
 71                               delay:0
 72                             options:UIViewAnimationOptionCurveEaseOut
 73                          animations:^{
 74                              recognizer.view.center = finalPoint;
 75                          }
 76                          completion:nil];
 77     }
 78 }
 79 
 80 /**
 81  *  ???????????
 82  *
 83  *  @param recognizer ???????????????????
 84  */
 85 - (void)handlePinch:(UIPinchGestureRecognizer *)recognizer {
 86     CGFloat scale = recognizer.scale;
 87     recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, scale, scale); //?????????С????????????仯???????????? CGAffineTransformMakeScale ???????????С????????б仯
 88     recognizer.scale = 1.0;
 89 }
 90 
 91 /**
 92  *  ???????????
 93  *
 94  *  @param recognizer ???????????????????
 95  */
 96 - (void)handleRotation:(UIRotationGestureRecognizer *)recognizer {
 97     recognizer.view.transform = CGAffineTransformRotate(recognizer.view.transform, recognizer.rotation);
 98     recognizer.rotation = 0.0;
 99 }
100 
101 /**
102  *  ?????????
103  *
104  *  @param recognizer ??????????????????
105  */
106 - (void)handleTap:(UITapGestureRecognizer *)recognizer {
107     UIView *view = recognizer.view;
108     view.transform = CGAffineTransformMakeScale(1.0, 1.0);
109     view.transform = CGAffineTransformMakeRotation(0.0);
110     view.alpha = 1.0;
111 }
112 
113 /**
114  *  ???????????
115  *
116  *  @param recognizer ??????????????????
117  */
118 - (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer {
119     //????????????ò???????0.7
120     recognizer.view.alpha = 0.7;
121 }
122 
123 /**
124  *  ???????????
125  *
126  *  @param recognizer ???????????????????
127  */
128 - (void)handleSwipe:(UISwipeGestureRecognizer *)recognizer {
129     //????鷽????????????
130     void (^positionOperation)() = ^() {
131         CGPoint newPoint = recognizer.view.center;
132         newPoint.y -= 20.0;
133         _imgV.center = newPoint;
134         
135         newPoint.y += 40.0;
136         _imgV2.center = newPoint;
137     };
138     
139     //??????????????в??????
140     switch (recognizer.direction) {
141         case UISwipeGestureRecognizerDirectionRight: {
142             positionOperation();
143             break;
144         }
145         case UISwipeGestureRecognizerDirectionLeft: {
146             positionOperation();
147             break;
148         }
149         case UISwipeGestureRecognizerDirectionUp: {
150             break;
151         }
152         case UISwipeGestureRecognizerDirectionDown: {
153             break;
154         }
155     }
156 }
157 
158 /**
159  *  ?????????????
160  *
161  *  @param recognizer ?????????????????????
162  */
163 - (void)handleCustomGestureRecognizer:(KMGestureRecognizer *)recognizer {
164     //????鷽????????????
165     void (^positionOperation)() = ^() {
166         CGPoint newPoint = recognizer.view.center;
167         newPoint.x -= 20.0;
168         _imgV.center = newPoint;
169         
170         newPoint.x += 40.0;
171         _imgV2.center = newPoint;
172     };
173     
174     positionOperation();
175 }
176 
177 
178 #pragma mark - ?????????
179 /**
180  *  ?????????
181  *
182  *  @param imgVCustom ????????????????
183  */
184 - (void)bindPan:(UIImageView *)imgVCustom {
185     UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self
186                                                                                  action:@selector(handlePan:)];
187     [imgVCustom addGestureRecognizer:recognizer];
188 }
189 
190 /**
191  *  ?????????
192  *
193  *  @param imgVCustom ????????????????
194  */
195 - (void)bindPinch:(UIImageView *)imgVCustom {
196     UIPinchGestureRecognizer *recognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self
197                                                                                      action:@selector(handlePinch:)];
198     [imgVCustom addGestureRecognizer:recognizer];
199     //[recognizer requireGestureRecognizerToFail:imgVCustom.gestureRecognizers.firstObject];
200 }
201 
202 /**
203  *  ?????????
204  *
205  *  @param imgVCustom ????????????????
206  */
207 - (void)bindRotation:(UIImageView *)imgVCustom {
208     UIRotationGestureRecognizer *recognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self
209                                                                                            action:@selector(handleRotation:)];
210     [imgVCustom addGestureRecognizer:recognizer];
211 }
212 
213 /**
214  *  ????????
215  *
216  *  @param imgVCustom ????????????????
217  */
218 - (void)bindTap:(UIImageView *)imgVCustom {
219     UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
220                                                                                  action:@selector(handleTap:)];
221     //???????????????????????????????
222     recognizer.numberOfTapsRequired = 2;
223     recognizer.numberOfTouchesRequired = 1;
224     [imgVCustom addGestureRecognizer:recognizer];
225 }
226 
227 /**
228  *  ??????????
229  *
230  *  @param imgVCustom ????????????????
231  */
232 - (void)bindLongPress:(UIImageView *)imgVCustom {
233     UILongPressGestureRecognizer *recognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
234     recognizer.minimumPressDuration = 0.5; //????С???????????0.5??
235     [imgVCustom addGestureRecognizer:recognizer];
236 }
237 
238 /**
239  *  ??????????????????????????????????????????????????
240  */
241 - (void)bindSwipe {
242     //???????????
243     UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self
244                                                                                      action:@selector(handleSwipe:)];
245     recognizer.direction = UISwipeGestureRecognizerDirectionRight; //???????????????? UISwipeGestureRecognizerDirectionRight???????????
246     [self.view addGestureRecognizer:recognizer];
247     [recognizer requireGestureRecognizerToFail:_customGestureRecognizer]; //??????????????????????????
248     
249     //???????????
250     recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self
251                                                            action:@selector(handleSwipe:)];
252     recognizer.direction = UISwipeGestureRecognizerDirectionLeft;
253     [self.view addGestureRecognizer:recognizer];
254     [recognizer requireGestureRecognizerToFail:_customGestureRecognizer]; //??????????????????????????
255 }
256 
257 /**
258  *  ?????????????????ж?????????β????????????????????????????????л??????
259  */
260 - (void)bingCustomGestureRecognizer {
261     //?? recognizer.state ? UIGestureRecognizerStateEnded ???????л?????? handleCustomGestureRecognizer:
262     
263     //_customGestureRecognizer = [KMGestureRecognizer new];
264     _customGestureRecognizer = [[KMGestureRecognizer alloc] initWithTarget:self
265                                                                     action:@selector(handleCustomGestureRecognizer:)];
266     [self.view addGestureRecognizer:_customGestureRecognizer];
267 }
268 
269 - (void)layoutUI {
270     //????? _imgV
271     UIImage *img = [UIImage imageNamed:@"Emoticon_tusiji_icon"];
272     CGFloat cornerRadius = img.size.width;
273     _imgV = [[UIImageView alloc] initWithImage:img];
274     _imgV.frame = CGRectMake(20.0, 20.0,
275                              cornerRadius * 2, cornerRadius * 2);
276     _imgV.userInteractionEnabled = YES;
277     _imgV.layer.masksToBounds = YES;
278     _imgV.layer.cornerRadius = cornerRadius;
279     _imgV.layer.borderWidth = 2.0;
280     _imgV.layer.borderColor = [UIColor grayColor].CGColor;
281     [self.view addSubview:_imgV];
282     
283     //????? _imgV2
284     img = [UIImage imageNamed:@"Emoticon_tusiji_icon2"];
285     cornerRadius = img.size.width;
286     _imgV2 = [[UIImageView alloc] initWithImage:img];
287     _imgV2.frame = CGRectMake(20.0, 40.0 + _imgV.frame.size.height,
288                               cornerRadius * 2, cornerRadius * 2);
289     _imgV2.userInteractionEnabled = YES;
290     _imgV2.layer.masksToBounds = YES;
291     _imgV2.layer.cornerRadius = cornerRadius;
292     _imgV2.layer.borderWidth = 2.0;
293     _imgV2.layer.borderColor = [UIColor orangeColor].CGColor;
294     [self.view addSubview:_imgV2];
295     
296     
297     [self bindPan:_imgV];
298     [self bindPinch:_imgV];
299     [self bindRotation:_imgV];
300     [self bindTap:_imgV];
301     [self bindLongPress:_imgV];
302     
303     [self bindPan:_imgV2];
304     [self bindPinch:_imgV2];
305     [self bindRotation:_imgV2];
306     [self bindTap:_imgV2];
307     [self bindLongPress:_imgV2];
308     
309     //??????????????????????????????????????????????
310     [self bingCustomGestureRecognizer];
311     [self bindSwipe];
312 }
313 
314 @end