【发布时间】:2016-06-08 15:12:16
【问题描述】:
我正在尝试使用 XCTestCase 在不同方向测试我的 iOS 应用程序。我需要一种以编程方式改变方向的方法。我尝试在 2 种方法中执行此操作,但都没有改变方向(方向保持为 UIInterfaceOrientationPortrait)。
尝试 1
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft;`
尝试 2
[[UIDevice currentDevice] setValue:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft] forKey:@"orientation"];`
当我阅读 [[UIApplication sharedApplication] statusBarOrientation] 是否有其他方法可以更改方向以进行测试?
【问题讨论】:
标签: ios objective-c xctest xctestcase