ios - 如何为页面 View Controller 提供 "Cover Vertical"过渡样式

标签 ios swift uistoryboard ios-animations

使用导航 View Controller ,我可以提供“垂直覆盖”过渡样式动画。但是,使用页面 View Controller 复制该内容时遇到困难。 Storyboard中给出的唯一选项是“滚动”和“卷页”。有没有办法以编程方式执行此操作?

最佳答案

看起来有点棘手,但应该可以:

创建一个 UIViewController,它将成为容器 Controller 。在您想要的位置添加 UIPageControl。然后以编程方式添加 UINavigationViewController 作为容器的子级,并将其 View 添加到 View 层次结构中。您可以使用主 Storyboard的 instantiateViewControllerWithIdentifier: ,并且如果您使用 AutoLayout,请不要忘记为其设置约束。当用户在 UINavigationViewController 中导航时,使用容器和 UINavigationViewController 或 UINavigationViewController 的parentViewController 属性之间的委托(delegate)来更改 UIPageControl。

UIPageViewController 适合只做一件事。大多数时候我更喜欢使用自定义容器 Controller 而不是使用它。

关于ios - 如何为页面 View Controller 提供 "Cover Vertical"过渡样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31121565/

相关文章:

ios - 我无法在 TableView 内加载 TableView 单元格

swift - 如何使用prepare for segue发送结构体实例

ios - 我真的需要为每个 UIStoryboard 语言文件添加两次相同的元素吗?

ios - Xcode 6 : iOS doesn't use storyboard localizations

ios - 通过 Storyboard使用自动布局创建拉伸(stretch)标题

ios - Swift 包管理器与未版本化包有关的问题(例如 : firebase-ios-sdk)

iphone - 无法以编程方式隐藏使用 IB 创建的 UIButton

ios - Swift 4 中使用 Date() 的向上和向下计时器应在特定时间段后停止

ios - 没有时区信息的 NSDate 和字符串

ios - 如何判断 AFNetworking 远程调用中返回的字符串