如何添加第二个UIPageViewController [英] How to add a second UIPageViewController

查看:156
本文介绍了如何添加第二个UIPageViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用UIPageViewController创建一个项目来实现翻页效果。我正在使用故事板,我认为很棒,设置UIPageViewController。如何添加第二个UIPageViewController并将其挂钩?我已经发布了一些截图来展示我到目前为止所做的事情。

I'm creating a project using UIPageViewController for the page turning effect. I'm using storyboard, which I think is great, to setup the UIPageViewController. How do I add a second UIPageViewController and hook it up? I have posted some screenshots to show what I've done so far.

推荐答案

我认为您要做的是实现页面视图控制器数据源代理:

I think what you are looking to do is to implement the page view controller data source delegates:

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController

这些当从页面视图控制器请求时,两个函数返回下一个和上一个视图控制器。

These two functions return the next and previous view controllers when they are requested from the page view controller.

如果您创建一个新的基于页面的应用程序项目,您可以在ModelController中完成此操作,该模型是示例pageViewController的数据源。

If you make a new "Page-Based Application" project, you can follow how this done in the ModelController which is the data source for the example pageViewController.

这篇关于如何添加第二个UIPageViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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