iOS Swift:UIPageViewController - 以编程方式翻页 [英] iOS Swift: UIPageViewController - Turning page programmatically

查看:26
本文介绍了iOS Swift:UIPageViewController - 以编程方式翻页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIPageViewController,当我们向左或向右滑动翻页时它可以正常工作.

I have a UIPageViewController, which works fine when we swipe left or right to turn pages.

class ViewController: UIViewController, UIPageViewControllerDataSource {
...
}

现在我打算在页面上也提供上一页/下一页按钮,这样可以通过点击这些按钮来翻页.

Now I intend to provide Previous/Next button on the page too, so that pages can be turned by clicking on these buttons.

如何以编程方式触发向左/向右滑动行为或翻页?

How can I trigger the swipe left/right behaviour OR turn pages programmatically?

这是针对 Swift 语言的问题,而不是针对 Objective-C.

This is a question for Swift language, not Objective-C.

推荐答案

使用此功能并为您想要的动画设置过渡样式.

Use this funtion and set the transition style for the animation you want.

这篇关于iOS Swift:UIPageViewController - 以编程方式翻页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆