有没有办法在 iOS 5 中实现可缩放的 UIPageViewController?
iOS 5 中新增了一个视图控制器:UIPageViewController,它支持像 iBook 一样翻页。但支持放大/缩小页面有问题。
然后我将滚动视图添加到 RootViewController 的视图中。并将 UIPageViewController 的视图添加为该滚动视图的子视图。然后放大/缩小可以在纵向和横向模式下工作。但另一个问题又出现了。放大视图后,翻页手势不再起作用。我认为这可能是因为滚动视图的手势和页面视图的手势之间的冲突。
我注意到有这样的语句:
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
所以我将其更改为:
self.scrollView.gestureRecognizers = self.pageViewController.gestureRecognizers;
但它崩溃了,错误消息类似于:
* -[UIScrollViewPanGestureRecognizer setMaximumNumberOfTouches:]: message sent to deallocated instance 0x6b80150
任何想法?谢谢
There is a new View Controller in iOS 5: UIPageViewController which supports to turn page like iBook. But there is a problem to support zoom in/out page.
Then I add a scrollview to RootViewController's view. And add UIPageViewController's view as a subview of this scrollview. Then the zoom in/out works in both portrait and landscape mode. But another problem arise. After I zoom in the view, the page turning gesture doesn't work anymore. I think this may because of the conflict between scrollview's gesture and pageview's gesture.
I noticed that there is a statement like this:
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
So I change it to:
self.scrollView.gestureRecognizers = self.pageViewController.gestureRecognizers;
But it crashes, the error message is something like:
* -[UIScrollViewPanGestureRecognizer setMaximumNumberOfTouches:]: message sent to deallocated instance 0x6b80150
Any idea? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你应该向后做。
将滚动视图放入页面视图控制器中,并更改滚动视图上的平移手势以使用多个手指。
You should do it backwards.
Put the scrollview(s) inside the pageviewcontroller and change the panning gesture on the scrollview to use more than one finger.
Nonono,将gestureRecognizers设置为另一个数组真的很糟糕。它只是暴露出来的,所以你可以调整它们,但不要替换整个阵列。
如果禁用弹跳,则翻页功能在大多数情况下都有效。
Nonono, setting the gestureRecognizers to another array is really bad. It's just exposed so you can tweak them, but don't replace the whole array.
If you disable bouncing then the page turn works most of the time.