我正在开发一个应用程序,我正在使用 iOS5 故事板。基本上我所拥有的是一个 UITabBarController 作为根控制器,其中包含一些 UIViewController 和一个 UISplitViewController。我想要做的是使用 UIPageViewController 作为 UISplitViewController 的 DetailController。问题是 UIPageViewController 没有显示它的视图控制器,但它显示了一个黑屏。我所做的是在 DetailController 的 viewDidLoad 方法中初始化两个内容视图控制器,并为其分配指令:
[self setViewControllers:self.pagesViewControllerArray direction:UIPageViewControllerNavigationOrientationHorizontal animated:NO completion:nil];
所以我无法弄清楚错误在哪里。
viewDidLoad 方法如下:
- (void)viewDidLoad{
self.dataSource = self;
self.delegate = self;
self.page1ViewController = [[Page1ViewController alloc] initWithNibName:@"Page1ViewController" bundle:nil];
self.page2ViewController = [[Page2ViewController alloc] init];
self.pagesViewControllerArray = [NSArray arrayWithObjects:self.page1ViewController, self.page2ViewController, nil];
[self setViewControllers:self.pagesViewControllerArray direction:UIPageViewControllerNavigationOrientationHorizontal animated:NO completion:nil];
}
我尝试同时使用带有 nib 关联的视图控制器和动态加载视图的视图控制器,但它不起作用。
任何帮助将非常感激。谢谢