且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在iOS6中处理手势识别器

更新时间:2023-01-25 14:05:37

我这样做是为了解决问题,根据需要更改它:

I've done this to workaround the issue, change it as you see fit:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
      [self MyCommonSelector];// this will work for ios 5
      return Yes;
 }

在你声明的按钮中添加目标,这将在iOS 6中调用:

Add target in button where you declare so this will call in iOS 6:

[self.myButton addTarget:self action:@selector(MyCommonSelector)
  forControlEvents:UIControlEventTouchUpInside];

用这个方法做你的东西,也可以通过按钮点击并从你需要的手势调用致电:

Do your stuff in this method which will also be called on button tap and from the gesture you need to call:

-(void)MyCommonSelector
 {
    //Do your stuff here what you want to do with Gesture too.
 }