How can I capture a sideways swipe gesture for a t

2019-08-21 12:08发布

I have a tableView that is one of the views inside a pageControl. I want to be able to capture and respond to a sideways swipe gesture if it's within the tableView, and have the pageControl respond if it is outside of the tableView.

How can I do this?

1条回答
Bombasti
2楼-- · 2019-08-21 12:32

As I see it, since swiping the table for an action and swiping the table to change pages is pretty much the same motion, you would just have to disable scrolling on the scrollview, scrollview.scrollEnabled = NO; and create a gesture recognizer for your table view, UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget: self action: @selector(myAction:)]; I haven't tested this code so please let me know if you run into any problems.

查看更多
登录 后发表回答