I have a project where my screen needs to be tested on both landscape and portrait orientations and it needs to happen automatically as I am running some UI test cases for that I use the below code.
let value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
This works fine on iPhone simulator and the simulator turns itself to landscape mode but on iPad simulator doesn't rotate itself
Things I have tried :
Added the below code to
UIViewController.attemptRotationToDeviceOrientation()
Also didn't work and checked if the orientation is supported by iPad or not using :
self.supportedInterfaceOrientations
Wich returned 30 (All orientations were supported)
- If the iPad simulator rotates (physically) at all?
- If yes am I missing anything?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…