Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
672 views
in Technique[技术] by (71.8m points)

ios - iPad doesn't auto rotate to landscape

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)

  1. If the iPad simulator rotates (physically) at all?
  2. If yes am I missing anything?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...