相关疑难解决方法(0)

[UIScreen mainScreen] .bounds.size在iOS8中是否依赖于方向?

我在iOS 7和iOS 8中运行了以下代码:

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
BOOL landscape = (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight);
NSLog(@"Currently landscape: %@, width: %.2f, height: %.2f", 
      (landscape ? @"Yes" : @"No"), 
      [[UIScreen mainScreen] bounds].size.width, 
      [[UIScreen mainScreen] bounds].size.height);
Run Code Online (Sandbox Code Playgroud)

以下是iOS 8的结果:

Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 568.00, height: 320.00
Run Code Online (Sandbox Code Playgroud)

与iOS 7中的结果相比:

Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 320.00, height: 568.00
Run Code Online (Sandbox Code Playgroud)

是否有任何文件指定此更改?或者它是iOS 8 API中的临时错误?

orientation uiinterfaceorientation ios uiscreen ios8

184
推荐指数
8
解决办法
8万
查看次数