1
我無法找到ViewView控制器作爲頁面的PageViewController的工作示例。PageViewController with ViewControllers
我只需要兩個水平視圖控制器:viewcontroller1和viewcontroller2。
這裏是我的viewDidLoad:
- (void)viewDidLoad {
[super viewDidLoad];
self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationVertical options:nil];
self.pageController.dataSource = self;
[[self.pageController view] setFrame:[[self view] bounds]];
storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle: nil];
controller1 = [storyboard instantiateViewControllerWithIdentifier:@"first"];
controller2 = [storyboard instantiateViewControllerWithIdentifier:@"second"];
viewControllers = [NSArray arrayWithObjects:controller1, nil];
[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:self.pageController];
[[self view] addSubview:[self.pageController view]];
[self.pageController didMoveToParentViewController:self];
}
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController {
return controller1;
}
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController {
return controller2;
}
的問題是,刷卡第二種觀點之後,就消失了。 一些幫助理解PageViewController會很好。
在此先感謝