Using UIPageViewController in storyboards

喜夏-厌秋 提交于 2020-01-03 13:37:45

问题


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.

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


回答1:


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).

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


来源:https://stackoverflow.com/questions/15732919/using-uipageviewcontroller-in-storyboards

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!