在故事板中使用UIPageViewController [英] Using UIPageViewController in storyboards

查看:62
本文介绍了在故事板中使用UIPageViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以在故事板上配置UIPageViewController的数据源,委托和视图控制器,而无需编写代码?我确实在UIPageViewController中看到了数据源和委托的出口,但是无法在场景之间建立连接,也无法在同一场景中添加其他控制器.

Is there a way to configure datasource, delegate and view controllers for UIPageViewController in storyboard without writing a code? I do see outlets for datasource and delegate in UIPageViewController, but there is no way to do connections between scenes, and no way to add additional controller into the same scene.

如果用IB根本无法配置UIPageViewController,那么在Interface Builder中拥有UIPageViewController的目的是什么?

What is the purpose to have UIPageViewController in Interface Builder if it is not configurable at all with IB?

推荐答案

它在Xcode中是完全可配置的.您将把 data-source delegate 出口连接到继承适当协议的类( UIPageViewControllerDataSource UIPageViewControllerDelegate ).

It is fully configurable in Xcode. You'll connect the data-source and delegate outlets to classes that inherit the appropriate protocols (UIPageViewControllerDataSource and UIPageViewControllerDelegate).

但是,您必须为这两个协议做一些实现-通常是通过访问模型的数据来实现的.让UIPageView的控制器处理这两种协议是很常见的,但不是必需的.为:

But, you must do some implementation for the two protocols - usually by accessing your model's data. It is common, but not required, to have the controller for the UIPageView be handle these two protocols. As:

@interface MyPageViewController : UIPageViewController
  <UITableViewDataSource,  UITTableViewDelegate>
...
@end

这篇关于在故事板中使用UIPageViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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