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


打印结果(横屏,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尺寸赋值。  大家若有好办法,请告诉我一下,多谢!



posted @ 2017-04-13 17:18  zsychanpin  阅读(181)  评论(0)    收藏  举报