我想在不同的方向使用XCTestCase测试我的iOS应用程序。我需要一种编程方式来改变方向。我尝试了2种方法,但都没有改变方向(方向保持为UIInterfaceOrientationPortrait)。如何更改XCTest for iOS上的测试方向?
尝试1
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationLandscapeLeft;`
尝试2
[[UIDevice currentDevice] setValue:[NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft] forKey:@"orientation"];`
当我读到[UIApplication的sharedApplication] statusBarOrientation] 有另一种方式来改变用于测试目的的方向是什么?