繁体   English   中英

如何为Page View Controller提供“垂直覆盖”过渡样式

[英]how to give Page View Controller a “Cover Vertical” transition style

使用Navigation View Controller,我可以给出“垂直覆盖”过渡样式的动画。 但是,在使用Page View Controller复制该代码时遇到了麻烦。 故事板上提供的唯一选项是“滚动”和“页面卷曲”。 有办法以编程方式执行此操作吗?

它看起来有些棘手,但应该可以使用:

创建一个UIViewController,它将是一个容器控制器。 在需要的地方添加UIPageControl。 然后以编程方式将UINavigationViewController添加为容器的子项,并将其视图添加到视图层次结构中。 您可以使用主情节提要的InstantiateViewControllerWithIdentifier:,并且如果您使用的是AutoLayout,请不要忘记为其设置约束。 当用户在UINavigationViewController中导航时,请在容器与UINavigationViewController或UINavigationViewController的parentViewController属性之间使用委托来更改UIPageControl。

UIPageViewController最好只做一件事情。 大多数时候,我更喜欢使用自定义容器控制器而不是使用它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM