如何捕获pageControl内的tableView的横向滑动手势? [英] How can I capture a sideways swipe gesture for a tableView that is inside of a pageControl?

查看:81
本文介绍了如何捕获pageControl内的tableView的横向滑动手势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个tableView,它是pageControl内部的视图之一.我希望能够捕获并响应侧滑手势(如果它位于tableView内),并且让pageControl响应(如果它位于tableView之外).

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.

我该怎么做?

推荐答案

正如我所看到的,由于滑动表进行操作和滑动表以更改页面几乎是相同的动作,因此您只需要禁用滚动即可在滚动视图上, scrollview.scrollEnabled = NO; 并为您的表视图创建手势识别器, UISwipeGestureRecognizer * recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:自我操作:@selector(myAction :)] ;我尚未测试此代码,因此如果您遇到任何问题,请告诉我.

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.

这篇关于如何捕获pageControl内的tableView的横向滑动手势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆