在iOS 8中,[UIScreen mainScreen].边界.大小是否变得与方向有关?我在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);以下是IOS 8的结果:Currently landscape: No, width: 320.00, height: 568.00Currently landscape: Yes, width: 568.00, height: 320.00与IOS 7中的结果相比:Currently landscape: No, width: 320.00, height: 568.00Currently landscape: Yes, width: 320.00, height: 568.00是否有指定此更改的文档?或者是iOS 8 API中的临时错误?
3 回答

当年话下
TA贡献1890条经验 获得超9个赞
[UIScreen界]现在面向界面 [UIScreen应用程序框架]现在面向接口 状态栏帧通知面向接口。 键盘帧通知是面向接口的。

守候你守候我
TA贡献1802条经验 获得超10个赞
+ (CGSize)screenSize { CGSize screenSize = [UIScreen mainScreen].bounds.size; if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape ([UIApplication sharedApplication].statusBarOrientation)) { return CGSizeMake(screenSize.height, screenSize.width); } return screenSize;}

小唯快跑啊
TA贡献1863条经验 获得超2个赞
+ (CGRect)screenBoundsFixedToPortraitOrientation { UIScreen *screen = [UIScreen mainScreen]; if ([screen respondsToSelector:@selector(fixedCoordinateSpace)]) { return [screen.coordinateSpace convertRect:screen.bounds toCoordinateSpace:screen.fixedCoordinateSpace]; } return screen.bounds;}
- 3 回答
- 0 关注
- 1018 浏览
添加回答
举报
0/150
提交
取消