iOS 如何获取屏幕大小

 

 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

转载于:https://www.cnblogs.com/jukaiit/p/4691944.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值