我想在标签栏内的视图控制器之间滑动。但是当我声明它的根视图控制器时,标签栏也隐藏,用户无法在标签栏之间导航。 如何在不将其声明为根视图控制器的情况下实现此目的。
UIPageViewController *pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
RKSwipeBetweenViewControllers *navigationController = [[RKSwipeBetweenViewControllers alloc]initWithRootViewController:pageController];
//%%% DEMO CONTROLLERS
UIViewController *demo = [[UIViewController alloc]init];
UIViewController *demo2 = [[UIViewController alloc]init];
UIViewController *demo3 = [[UIViewController alloc]init];
UIViewController *demo4 = [[UIViewController alloc]init];
demo.view.backgroundColor = [UIColor redColor];
demo2.view.backgroundColor = [UIColor whiteColor];
demo3.view.backgroundColor = [UIColor grayColor];
demo4.view.backgroundColor = [UIColor orangeColor];
[navigationController.viewControllerArray addObjectsFromArray:@[demo,demo2,demo3,demo4]];
[[[UIApplication sharedApplication] delegate] window].rootViewController = navigationController;
[[[[UIApplication sharedApplication] delegate] window] makeKeyAndVisible];
答案 0 :(得分:1)
在这些代码行下方,您可以在视图控制器之间添加和滑动。
[yourView addSubview:navigationController.view];
[self addChildViewController:navigationController];
[navigationController didMoveToParentViewController:self];