UIPageViewController 和景观
我一直在尝试以下操作,但没有任何效果,
NSDictionary *pageViewOptions = [NSDictionary dictionaryWithObjectsAndKeys:UIPageViewControllerOptionSpineLocationKey, [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMid],nil];
NSLog(@"pageViewOptions :%@",pageViewOptions);
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:pageViewOptions];
NSLog(@"spineLocation :%d",self.pageViewController.spineLocation);
pageViewOptions 处的 NSlog 为 2,spineLocation 处的 NSlog 为 1。这让我陷入困境,我想做的就是在中间使用脊柱进行初始化。它总是在左侧初始化。该应用程序在横向模式下初始化,但仅在将设备旋转 180 度后才执行该方法 “- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spinLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation” 有效,然后我的脊柱就在中间了。有人可以解释一下吗?我到处寻找答案。
我想要它做的就是在横向中初始化,中间有一个脊柱
I have been trying the following and nothing is working
NSDictionary *pageViewOptions = [NSDictionary dictionaryWithObjectsAndKeys:UIPageViewControllerOptionSpineLocationKey, [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMid],nil];
NSLog(@"pageViewOptions :%@",pageViewOptions);
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:pageViewOptions];
NSLog(@"spineLocation :%d",self.pageViewController.spineLocation);
the NSlog at pageViewOptions is 2, NSlog at spineLocation is 1. This is driving me up the wall, all i want to do is initialise with spine in the middle. It always initialises on the left. the app is initialised in landscape but only after rotating the device 180 degrees the method
"- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation"
works and then i get spine in the middle. could someone please shed some light on this. I've searched everywhere for an answer.
all i want it to do is initialise in landscape with a spine in the middle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用“options”参数:
并且不要忘记初始化 2 个内容视图控制器:
Try to use "options" parameter:
And don't forget to initialize 2 content view controllers: