PageViewController:忽略下一页/上一页手势识别器
我有一个应用程序,其中有一个 PageViewController,可以在用户不执行任何操作的情况下连续显示其页面。我想完全阻止用户的访问。在显示所有页面后,我有一个后退按钮出现在顶部。但是,如果我尝试点击它......它会再次开始浏览页面(它位于您通常点击以转到上一页的区域)。
那么,有谁知道我如何“删除”手势识别器?
我尝试评论该行:
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
来自 RootViewController 但它不起作用。
I have a app in which I have a PageViewController that shows it's pages on after another without the user doing anything. I want to totally block the user's acces. I have a back button that appears on the top after all of pages have been shown. But if I try to tap it ... it starts going through the pages again (it's in the area that you would usually tap to go to previous page).
So, does anyone have any idea how could I "remove" the gesture recognizers ?
I tried commenting the line :
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
from RootViewController but it didn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己没有尝试过,它可能不会适合每个人,但对于您的特定情况,因为您正在手动更改它应该工作的所有页面。我在 UIPageViewController 文档中找到了以下内容< /a> 在概述部分。
您仍然需要注释掉上面提到的行,而且还要
self.pageViewController.dataSource = self.modelController;
编辑:我自己测试了一下,它有效。无法导航使用任何手势,但可以通过编程方式。
I haven't tried this myself, and it probably won't be the solution for everyone, but for your particular case because you're manually changing all the pages it should work. I found the following tid-bit in the UIPageViewController documentation in the Overview section.
You will still want to comment out the line that you mentioned above, but also
self.pageViewController.dataSource = self.modelController;
EDIT: Just tested this myself and it works. Can't navigate with any of the gestures, but can programmatically.