【问题标题】:UIPageViewController transitioning to another view on eventUIPageViewController 在事件中转换到另一个视图
【发布时间】:2014-09-12 00:29:57
【问题描述】:

我有一个带有 3 个视图的 UIPageViewController。我想在按钮事件上从一个视图更改为另一个视图(类似于可以帮助您导航的 snapchat 按钮,即使滑动也可以完成这项工作)。我目前正在使用以下内容:

//the navWrapper is the view currently displayed
//it asks the PageViewController to set its view abruptly to the nextWrapper
[navWrapper.rootViewController.pageViewController setViewControllers:@[nextWrapper] direction:UIPageViewControllerNavigationDirectionReverse animated:NO completion:nil];

这很有效,因为它改变了正确显示的视图控制器,但我正在寻找一种方法来实现这种过渡就像滑动一样(而不是视图中的剧烈变化没有正在播放的动画)。

一直在四处寻找,但还没有弄清楚,感谢建议:)

【问题讨论】:

  • 如果您想为过渡设置动画效果,请尝试使用 scrollView 而不是 PageView
  • 如果你想要动画,为什么要为动画参数传递 NO?

标签: ios objective-c uipageviewcontroller transitions


【解决方案1】:

为什么不将animated 设置为YES

[navWrapper.rootViewController.pageViewController setViewControllers:@[nextWrapper] direction:UIPageViewControllerNavigationDirectionReverse animated:YES completion:nil];

如果您有兴趣,可以在this question 中以编程方式触发手势识别器

【讨论】:

  • 天哪,太累了,把那些东西打得溜走xD谢谢!
猜你喜欢
  • 2011-12-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-03
  • 1970-01-01
  • 2013-03-14
  • 1970-01-01
相关资源
最近更新 更多