objective-c – UIPageViewController和landscape

objective-c – UIPageViewController和landscape,第1张

概述我一直在尝试以下,没有任何工作 NSDictionary *pageViewOptions = [NSDictionary dictionaryWithObjectsAndKeys:UIPageViewControllerOptionSpineLocationKey, [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMid] 我一直在尝试以下,没有任何工作

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 spineLocationForInterfaceOrIEntation:(UIInterfaceOrIEntation)orIEntation”
工作,然后我在中间得到脊柱.有人可以对此有所了解.我到处寻找答案.

我想要它做的就是在中间用脊椎进行初始化

解决方法 尝试使用“options”参数:

NSDictionary *options = (UIInterfaceOrIEntationIsLandscape(self.interfaceOrIEntation)) ? [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger:UIPageVIEwControllerSpineLocationMID] forKey: UIPageVIEwControllerOptionSpineLocationKey] : nil; self.pageVIEwController = [[UIPageVIEwController alloc] initWithTransitionStyle:UIPageVIEwControllerTransitionStylePageCurl navigationorIEntation:UIPageVIEwControllerNavigationorIEntationHorizontal options:options];...

并且不要忘记初始化2个内容视图控制器:

NSArray *vIEwControllers = [NSArray arrayWithObjects:contentVIEwController1,contentVIEwController2,nil];[self.pageVIEwController setVIEwControllers:vIEwControllers direction:UIPageVIEwControllerNavigationDirectionForward animated:NO completion:nil];
总结

以上是内存溢出为你收集整理的objective-c – UIPageViewController和landscape全部内容,希望文章能够帮你解决objective-c – UIPageViewController和landscape所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1080248.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存