我希望 2 UIPageViewController 与 2 轴(垂直和水平)一起正常工作:
问题是我的垂直子视图(pvcV)接管了水平子视图(pvcH),因为我在水平子视图之后声明了它。我该怎么做才能使两者一起工作?我在这里搜索了很多这种代码,但没有找到......
这是我在RootViewController中的代码:
self.pvcH = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
self.pvcH.delegate = self;
self.pvcV = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationVertical options:nil];
self.pvcV.delegate = self;
TCDataViewController *startingViewController = [self.modelController viewControllerAtIndex:0 storyboard:self.storyboard];
NSArray *viewControllers = @[startingViewController];
self.pvcH.dataSource = self.modelController;
self.pvcV.dataSource = self.modelController;
[self.pvcV setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
[self.pvcH setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
[self addChildViewController:self.pvcH];
[self addChildViewController:self.pvcV];
[self.view addSubview:self.pvcH.view];
[self.view addSubview:self.pvcV.view];
如果你能帮助我,非常感谢:)