ios启动页强制竖屏 ios启动页强制竖屏(进入App后允许横屏与竖屏)

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

ios启动页强制竖屏 ios启动页强制竖屏(进入App后允许横屏与竖屏)

Stevenzhai   2021-03-24 我要评论
想了解ios启动页强制竖屏(进入App后允许横屏与竖屏)的相关内容吗,Stevenzhai在本文为您仔细讲解ios启动页强制竖屏的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:ios,强制竖屏,ios开发,强制竖屏,ios,强制竖屏代码,下面大家一起来学习吧。

这篇文章主要介绍了在ios启动页强制竖屏,进入App后允许横屏与竖屏的相关资料,需要的朋友可以参考下。

方法如下

1、修改App-info.plist(在XCode中General中设置 一样的效果)

 <key>UISupportedInterfaceOrientations</key>
 <array>
  <string>UIInterfaceOrientationPortrait</string>
 </array>

2、AppDelegate中:

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
 return UIInterfaceOrientationMaskAllButUpsideDown;
}

贴一下苹果对这个的解释,可以放心使用:

Discussion

This method returns the total set of interface orientations supported by the app. When determining whether to rotate a particular view controller, the orientations returned by this method are intersected with the orientations supported by the root view controller or topmost presented view controller. The app and view controller must agree before the rotation is allowed.

If you do not implement this method, the app uses the values in the UIInterfaceOrientation key of the app's Info.plist as the default interface orientations.

总结

以上就是这篇文章的全部内容了,希望本文的内容对各位iOS开发者们能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对的支持。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们