ModalViewController 打开时禁用 UIPageViewController
我对这个网站完全陌生,但我已经喜欢它了:-)
我通过搜索有关 UIPageViewController 的问题找到了它。
我有一个普通的 UIPageViewController 应用程序,在其中打开一个 ModalViewController 来设置一些设置...
现在的问题: :-)
如果我单击 ModalView 右侧的完成按钮,要关闭它,PageViewController 会翻页,因为他认为该点击是他的意思;-)
只要打开了 ModalView,我就可以禁用 PageViewController GestureRecognizer 吗?
有没有办法禁用他的识别器?
感谢您提前提供的帮助...
cu Matze
I am totaly new to this site, but I already like it :-)
I found it by searching for a question about the UIPageViewController.
I have a normal UIPageViewController App, in which I open a ModalViewController for setting up some settings...
Now the Problem: :-)
If I click on the done Button on the right side of the ModalView, to dismiss it, the PageViewController turnes the page, because he thinks that he is meant by that click ;-)
Can I disable the PageViewController GestureRecognizer as long as I have a ModalView opened?
Is there a method to disable and later his recognizer?
thank you for your help in advance...
cu Matze
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的 UIPageViewController 会从其上呈现的模态视图中窃取触摸,这似乎很奇怪。除非您将模态视图嵌入到
UIPageViewController
的内容中?要回答您的问题 - 您可以通过枚举其
gestureRecognizers
属性(NSArray
)轻松禁用页面视图控制器的手势识别器:稍后使用
setEnabled 重新启用它们:是的。
更新:
在iOS 6中添加了
UIPageViewControllerTransitionStyleScroll
。使用此转换样式的 UIPageViewController 在gestureRecognizers
返回的数组中不返回任何手势识别器。据推测,具有这种转换样式的页面视图控制器使用底层的私有UIScrollView
实例(它的行为就像启用了分页的UIScrollView
),尽管我还没有检查过这一点。It seems odd that your
UIPageViewController
would steal touches from a modal view presented over it. Unless, perhaps, you are embedding the modal view within the content of theUIPageViewController
?To answer your question -- you can easily disable the page view controller's gesture recognizers by enumerating its
gestureRecognizers
property (anNSArray
):Re-enable them later with
setEnabled:YES
.UPDATE:
In iOS 6
UIPageViewControllerTransitionStyleScroll
has been added.UIPageViewController
s that use this transition style return no gesture recognisers in the array returned bygestureRecognizers
. Presumably page view controllers with this transition style use an underlying, privateUIScrollView
instance (it behaves just like aUIScrollView
with paging enabled), although I haven't checked this.