有没有办法在 iOS 5 中实现可缩放的 UIPageViewController?

发布于 2024-12-13 04:48:32 字数 655 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扛刀软妹 2024-12-20 04:48:32

你应该向后做。

将滚动视图放入页面视图控制器中,并更改滚动视图上的平移手势以使用多个手指。

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.

忱杏 2024-12-20 04:48:32

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文