iOS开发横竖屏

关于iOS横竖屏适配 - 简书

iOS横竖屏旋转及其基本适配方法 - 梧雨北辰的博客 - CSDN博客


适配主要需要得到

/*屏幕宽度*/

staticinlineCGFloattScreenWidth() {

    if ([UIScreen mainScreen].bounds.size.width>[UIScreen mainScreen].bounds.size.height) {

        return [UIScreen mainScreen].bounds.size.height;

    }else{

        return [UIScreen mainScreen].bounds.size.width;

    }

}

/*幕高度*/

staticinlineCGFloattScreenHeight() {

    if ([UIScreen mainScreen].bounds.size.width>[UIScreen mainScreen].bounds.size.height) {

        return [UIScreen mainScreen].bounds.size.width;

    }else{

        return [UIScreen mainScreen].bounds.size.height;

    }


}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • ios开发xcode6 ipad横竖屏怎么判断,怎么自适应控件 第一种:通过人为的办法改变view.transfo...
    寒桥阅读 11,131评论 1 9
  • 1、禁止手机睡眠[UIApplication sharedApplication].idleTimerDisabl...
    DingGa阅读 4,813评论 1 6
  • 1 CALayer IOS SDK详解之CALayer(一) http://doc.okbase.net/Hell...
    Kevin_Junbaozi阅读 10,590评论 3 23
  • iOS开发过程中,使用的一些常用宏定义 字符串是否为空#define kStringIsEmpty(str) ([...
    goyohol阅读 10,740评论 30 84
  • 人,总是很难改正自己的缺点,人,也总是很难发现自己的错误,有时,明知错了,却欲罢不能,一错再错,把握正确的方向,坚...
    Lzr_2017阅读 1,241评论 0 3