1. 程式人生 > >iOS 手勢重疊 iOS系統手勢與自定義手勢重疊, 手勢衝突

iOS 手勢重疊 iOS系統手勢與自定義手勢重疊, 手勢衝突

.m檔案

UIPanGestureRecognizer *swipe = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(clickSwipe:)];

   swipe.delegate = self;

   [cell addGestureRecognizer:swipe];

-(void)clickSwipe:(UIPanGestureRecognizer *)sw{

if ([sw state]== UIGestureRecognizerStateEnded){

//code....

    }

}

//然後重寫手勢的這個方法, 這個方法下面有詳細的介紹....

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizershouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{

return YES;

}