现在的位置: 首页 > 综合 > 正文

不同ios系统下mainscreen的applicationFrame和bounds值测试

2018年05月08日 ⁄ 综合 ⁄ 共 904字 ⁄ 字号 评论关闭

打印结果(横屏,3.5寸,若4寸则最后一项相应增加)

ios6:

2014-04-26 10:57:12.300 testAccount[18525:907] applicationFrame: {{0, 20}, {320, 460}}
2014-04-26 10:57:12.333 testAccount[18525:907] bounds: {{0, 0}, {320, 480}}

ios7:
2014-04-26 11:00:42.757 testAccount[2001:60b] applicationFrame: {{0, 20}, {320, 460}}

2014-04-26 11:00:42.764 testAccount[2001:60b] bounds: {{0, 0}, {320, 480}}

打印结果(竖屏,3.5寸,若4寸则最后一项相应增加)

ios6:

2014-04-26 10:57:12.300 testAccount[18525:907] applicationFrame: {{20, 0}, {300, 480}}
2014-04-26 10:57:12.333 testAccount[18525:907] bounds: {{0, 0}, {320, 480}}

ios7:
2014-04-26 11:00:42.757 testAccount[2001:60b] applicationFrame: {{20, 0}, {320, 480}}
2014-04-26 11:00:42.764 testAccount[2001:60b] bounds: {{0, 0}, {320, 480}}

结论: frame和bounds的值和它们的字面意思一样,一个包含了最上面的20的状态栏,1个不包含;系统的不同不会对这两个值造成影响。

因此无法用这两个值来直接对系统进行适配。还需要使用具体的方法来区分。

我这边对于手写的代码定义了:#define IOS7Plus (fabs((double)[[UIDevice currentDevice].systemVersion doubleValue])>=7.0f)宏,

使用该宏来判断系统对不同系统下的view尺寸赋值。  大家若有好办法,请告诉我一下,多谢!

抱歉!评论已关闭.