问题
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