Mar*_*yer 4 objective-c ipad ios5 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);
Run Code Online (Sandbox Code Playgroud)
pageViewOptions的NSlog是2,spineLocation的NSlog是1.这让我起了墙,我想做的就是在中间用脊椎初始化.它始终在左侧初始化.应用程序初始化为横向,但只有在旋转设备180度之后方法" - (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController*)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation"工作,然后我在中间得到脊椎.有人可以对此有所了解.我到处寻找答案.
我想要它做的就是在中间用脊椎进行初始化
小智 8
尝试使用"options"参数:
NSDictionary *options = (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) ? [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMid] forKey: UIPageViewControllerOptionSpineLocationKey] : nil;
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:options];
...
Run Code Online (Sandbox Code Playgroud)
并且不要忘记初始化2个内容视图控制器:
NSArray *viewControllers = [NSArray arrayWithObjects:contentViewController1, contentViewController2, nil];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3261 次 |
| 最近记录: |