iOS 屏幕适配

来源:互联网 发布:windows 命令行快捷键 编辑:程序博客网 时间:2024/06/05 09:19

http://blog.csdn.net/phunxm/article/details/42174937

(1)UIScreen.bounds

    // Bounds of entire screen in points(本地坐标系,起点为[0,0]

    @property(nonatomic,readonlyCGRect bounds

    --------------------------------------------------------------------------------

    //考虑转屏的影响,按照实际屏幕方向UIDeviceOrientation)的宽高

    #define SCREEN_WIDTH ([UIScreenmainScreen].bounds.size.width)

    #define SCREEN_HEIGHT ([UIScreenmainScreen].bounds.size.height)

    #define STATUSBAR_HEIGHT ([UIApplicationsharedApplication].statusBarFrame.size.height)

    //不考虑转屏的影响,只取竖屏UIDeviceOrientationPortrait)的宽高

    #define SCREEN_WIDTH MIN([UIScreenmainScreen].bounds.size.width, [UIScreenmainScreen].bounds.size.height)

    #define SCREEN_HEIGHT MAX([UIScreenmainScreen].bounds.size.height, [UIScreenmainScreen].bounds.size.width)

    #define STATUSBAR_HEIGHT MIN([UIApplicationsharedApplication].statusBarFrame.size.width, [UIApplicationsharedApplication].statusBarFrame.size.height)

0 0