ios – 使用横向模式在iPad上启动iPhone应用程序

ios – 使用横向模式在iPad上启动iPhone应用程序,第1张

概述在项目摘要中,“支持的界面方向”全部被选中,因为我的应用程序中有一个照片库视图,可以随设备一起旋转.其他观点仅限于肖像.目标设备是iPhone,所有东西在iPhone中都表现良好.但是当它在我的iPad上运行横向模式时,启动和rootView如下: 飞溅景观: rootview景观: 我期望看起来应该与iPad是纵向模式相同: 飞溅画像: rootview画像: rootView是MyNaviga 在项目摘要中,“支持的界面方向”全部被选中,因为我的应用程序中有一个照片库视图,可以随设备一起旋转.其他观点仅限于肖像.目标设备是iPhone,所有东西在iPhone中都表现良好.但是当它在我的iPad上运行横向模式时,启动和rootVIEw如下:

飞溅景观:

rootvIEw景观:

我期望看起来应该与iPad是纵向模式相同:

飞溅画像:

rootvIEw画像:

rootVIEw是MyNavigationController,一些相关的代码如下:

MyNavigationController.m

- (BOol)shouldautorotatetoInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation{  return (interfaceOrIEntation == UIInterfaceOrIEntationPortrait);}- (NSUInteger)supportedInterfaceOrIEntations {  return UIInterfaceOrIEntationMaskPortrait;}- (BOol)shouldautorotate {  return NO;}
解决方法 请使用以下代码更正您的代码:

- (BOol)shouldautorotate {   return YES;}- (NSUInteger)supportedInterfaceOrIEntations {   return UIInterfaceOrIEntationMaskPortrait;}

从shouldautorotate返回YES似乎很奇怪.事实是,如果你确实返回NO,那么根本不会调用supportedInterfaceOrIEntations,你的项目设置就会统治.您也可以删除shouldautorotate,它应该工作相同.

Reference:

When the user changes the device orIEntation,the system calls this method on the root vIEw controller or the topmost presented vIEw controller that fills the window. If the vIEw controller supports the new orIEntation,the window and vIEw controller are rotated to the new orIEntation. This method is only called if the vIEw controller’s shouldautorotate method returns YES.

总结

以上是内存溢出为你收集整理的ios – 使用横向模式在iPad上启动iPhone应用程序全部内容,希望文章能够帮你解决ios – 使用横向模式在iPad上启动iPhone应用程序所遇到的程序开发问题。

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

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

原文地址: http://outofmemory.cn/web/1082742.html

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

发表评论

登录后才能评论

评论列表(0条)

保存