SwipeLeft Gesture does not work on UITableView

I have a UITableView
. I don’t have ” canEditRowAtIndexPath
” implemented.

Following code works on controllers which don’t have UITableView but does not work on controller with UITableView.

I did try setCancelsTouchesInView = NO
on gestureRecognizer.

In container view controller, I have implemented:

UISwipeGestureRecognizer *leftGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeHandlerLeft:)];
[leftGestureRecognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];
[self.view addGestureRecognizer:leftGestureRecognizer];

You better try adding UISwipeGestureRecognizer
to your UITableViewCell
rather than UITableView
Try adding this in your cellForRowAtIndexPath

let recognizer = UISwipeGestureRecognizer(target: collectionView, action: #selector(handleGesture))
        recognizer.direction = .left
        recognizer.numberOfTouchesRequired = 1
        cell .addGestureRecognizer(recognizer)

func handleGesture(){

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 移动开发 » SwipeLeft Gesture does not work on UITableView

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录