(1)效果
(2)代码
http://download.csdn.net/detail/wsb200514/8261001
(3)总结
——先依据所需创建不同类型的手势识别。比方:
UITapGestureRecognizer UISwipeGestureRecognizer UIPinchGestureRecognizer UIRotateGestureRecognizer UIPanGestureRecognizer
——然后把这些手势对象利用addGestureRecognizer方法加入到须要的那个对象中去。如:
[self.imgView addGestureRecognizer:swipe];
——当然。这些手势都能够利用addTarget添加一些事件检測。如:
UIPinchGestureRecognizer *pinch=[[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(pinchView:)];
——还有,手势识别另一些比較经常使用的代理方法。例如以下面方法是否同意多个手势同一时候起作用:
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{ return YES; }
版权声明:本文博客原创文章,博客,未经同意,不得转载。