• 关于iOS中支持屏幕取向的讲解


    可以通过设置 VC对应的 XIB 中 View 的show attrubite inspector属性,更改其 Orientation为 Landscape,即可默认为横屏布局。
    我们可以通过3种方式设置 App界面的取向。

    第一种:通过全局设置
    // The system only calls this method if the application delegate has not
    // implemented the delegate equivalent. It returns the orientations specified by
    // the application's info.plist. If no supported interface orientations were
    // specified it will return UIInterfaceOrientationMaskAll on an iPad and
    // UIInterfaceOrientationMaskAllButUpsideDown on a phone.  The return value
    // should be one of the UIInterfaceOrientationMask values which indicates the
    // orientations supported by this application.
    - (NSUInteger)supportedInterfaceOrientationsForWindow:(UIWindow *)window NS_AVAILABLE_IOS(6_0);

    第2种,通过Deployment Info下的 Device Orientation 中选择取向,当然这里和 Plist 文件里Supported interface orientations对应的取向一致,改变一个地方另一个地方也会随之改变。

    第3种,单一的设置 VC 做支持的取向。通过函数(iOS 6.0以后)
    - (BOOL)shouldAutorotate{
    return YES;
    }

    - (NSUInteger)supportedInterfaceOrientations{
       return UIInterfaceOrientationMaskLandscape;
    }
    可以设置当前 VC 所支持的方向。

    最终视图所支持的取向由这3个的交集决定。需要注意的是Plist 文件里所支持的方向,会按照第一项来执行。(若支持)

    参考资料:http://www.tuicool.com/articles/e2q6zi, 
    图片:横屏布局.png 
  • 相关阅读:
    Linux下安装maven
    非连续性及反脆弱
    高手是怎么练成的
    思维型大脑
    编写文档五轮模式
    Nginx初识
    ida快捷键
    ida+gdb调试任意平台
    gcc常用命令使用
    ida调试ios应用
  • 原文地址:https://www.cnblogs.com/iOS-kk/p/5207515.html
Copyright © 2020-2023  润新知