我UIPageViewController
用来显示两个视图控制器。我希望这个视图控制器显示在不同的页面中,并且on swiping
页面应该被翻转。当我在 iPad 模拟器 6.0 中运行它时,它工作正常,但是当我在 iPad 模拟器 5.1 中运行它时,两个视图控制器都显示在同一页面上。这是代码
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:UIPageViewControllerSpineLocationMid] forKey:UIPageViewControllerOptionSpineLocationKey];
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:options];
//Step 2:
//Assign the delegate and datasource as self.
self.pageViewController.delegate = self;
self.pageViewController.dataSource = self;
//Step 3:
//Set the initial view controllers.
GameSelectViewController *gameViewController = [[GameSelectViewController alloc] initWithNibName:@"GameSelectViewController" bundle:nil];
HighscoreViewController *highScoreViewController = [[HighscoreViewController alloc] initWithNibName:@"HighscoreViewController" bundle:nil];
viewControllers = [NSArray arrayWithObjects:highScoreViewController,gameViewController, nil];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
//Step 4:
//ViewController containment steps
//Add the pageViewController as the childViewController
[self addChildViewController:self.pageViewController];
//Add the view of the pageViewController to the current view
[self.view addSubview:self.pageViewController.view];
//Call didMoveToParentViewController: of the childViewController, the UIPageViewController instance in our case.
[self.pageViewController didMoveToParentViewController:self];
//Step 5:
// set the pageViewController's frame as an inset rect.
self.pageViewController.view.frame = self.view.frame;
我是 iPhone 开发的新手。请只做那些需要的。谢谢。