0

我希望 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];

如果你能帮助我,非常感谢:)

4

1 回答 1

0

你应该把一个放在彼此里面。

例如:您最终将拥有一个水平 pageViewController,其中每个页面都是垂直 pageViewController,其中每个页面都是您的最终内容(我认为是 TCDateViewController)

于 2013-10-11T07:08:16.023 回答