Just create simple project. And we have a ViewController like
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func onAlertButton(_ sender: Any) {
let ac = UIAlertController(title: "title", message: "msg", preferredStyle: .alert)
let action = UIAlertAction(title: "OK", style: .default, handler: { _ in
ac.dismiss(animated: true)
})
ac.addAction(action)
present(ac, animated: true)
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .allButUpsideDown
}
override var shouldAutorotate: Bool {
return true
}
}
When run this app on iPadOS16 b4, then move to app landscape mode, and present UIAlert, the app goes to portrait. Also during alert is presenting, back to landscape, then dismiss alert, it goes to portrait too.
Under iPadOS15, app keep landscape, so my question is that this is intended behavior?