如何使用iOS故事板在UIPageviewController内创建多个UIViews?

时间:2015-11-17 13:59:04

标签: ios objective-c iphone uiview

我正在尝试在views内创建不同的pageviewcontroller,但pageviewcontroller希望在viewcontroller上显示上半部分。请在下面Image查看。

enter image description here

1 个答案:

答案 0 :(得分:0)

在故事板中为您的CustomPageViewController(继承自UIPageViewController)创建一个场景,并添加到此类的viewDidLoad中:

Error in View : arguments imply differing number of rows:

现在您可以通过UIPageViewControllerDataSource方法提供自定义视图控制器:

self.dataSource = self;
self.delegate = self;

您还可以在故事板中创建自定义视图控制器场景并将其加载到代码中:

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