码迷,mamicode.com
首页 > 移动开发 > 详细

iOS 如何获取屏幕大小

时间:2017-06-12 19:54:24      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:height   app   cat   nbsp   src   div   获取   origin   nes   

 

技术分享
 1  
 2     UIScreen *currentScreen = [UIScreen  mainScreen];
 3     
 4     NSLog(@"applicationFrame.size.height = %f",currentScreen.applicationFrame.size.height);
 5     
 6     NSLog(@"applicationFrame.size.width = %f",currentScreen.applicationFrame.size.width);
 7     
 8     NSLog(@"applicationFrame.origin.x = %f",currentScreen.applicationFrame.origin.x);
 9     
10     NSLog(@"applicationFrame.origin.y = %f",currentScreen.applicationFrame.origin.y);
11     
12     NSLog(@"bounds.x = %f",currentScreen.bounds.origin.x);
13     
14     NSLog(@"bounds.y = %f",currentScreen.bounds.origin.y);
15     
16     NSLog(@"bounds.height = %f",currentScreen.bounds.size.height);
17     
18     NSLog(@"bounds.width = %f",currentScreen.bounds.size.width);
19     
20     NSLog(@"brightness = %f",currentScreen.brightness);
技术分享

 

更新:

iOS 9 之后:使用 [UIScreen  mainScreen].bounds代替 [UIScreen  mainScreen].applicationFrame

iOS 如何获取屏幕大小

标签:height   app   cat   nbsp   src   div   获取   origin   nes   

原文地址:http://www.cnblogs.com/zhangyubao/p/6994387.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!