I have a class as below
class ViewController: UIViewController, ARSCNViewDelegate, SCNPhysicsContactDelegate {
@IBOutlet var sceneView: ARSCNView!
How to prevent the sceneView from rotating?
I tried many ways such as
add
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
override var shouldAutorotate: Bool {
return false
}
in UIViewController
Or add
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask
{
return UIInterfaceOrientationMask.portrait
}
in App delegate
When I run it on my ipad, it always rotates when I change my ipad orientation.