我已经尝试了以下方法,但都没有起作用
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);
页面视图选项中的NSLog为2,书脊位置中的NSLog为1。这真的让我很烦恼,我想要的只是用书脊初始化在中间。它总是在左边初始化。应用程序在横向模式下初始化,但只有在将设备旋转180度后,方法“-(UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation”才起作用,然后我可以得到中间的书脊。请问有人可以帮我解决这个问题吗?我已经到处寻找答案了。
我只想让它在横向模式下以书脊居中的方式初始化。