iOS 如何获取屏幕大小
发布日期:2021-05-09 04:03:55 浏览次数:18 分类:博客文章

本文共 886 字,大约阅读时间需要 2 分钟。

 

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

上一篇:UITableViewDataSource协议
下一篇:iOS 修改状态栏字体的颜色

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2025年03月29日 16时23分27秒