iOS macOS获取当前设备屏幕宽和高

#define GZDeviceWidth ([UIScreen mainScreen].bounds.size.width)
#define GZDeviceHeight ([UIScreen mainScreen].bounds.size.height)

//引用GZDeviceWidth 即为当前屏幕实际宽
//引用GZDeviceHeight 即为当前屏幕实际高

 

    NSLog(@"kkk:%f", [[NSScreen mainScreen] frame].size.width);//屏幕分辨率宽
    NSLog(@"kkk:%f", [[NSScreen mainScreen] frame].size.height);//屏幕分辨率高
    NSLog(@"kkk:%f", [NSScreen mainScreen].visibleFrame.size.width);//屏幕安全区域宽
    NSLog(@"kkk:%f", [NSScreen mainScreen].visibleFrame.size.height);//屏幕安全区域高

 

posted on 2017-10-19 16:52  高彰  阅读(2171)  评论(0编辑  收藏  举报

导航