I have viewController 1 that present the viewController with ARSCNView. between the transaction of the viewControllers, the orientation is changed, all the UI orientation is in the place but the ARSCNView camera view is in the wrong location
( view frame is in the current location but the camera view is upside down or left)
When I rotate the phone to portrait and back all look find.
The ARSCNView is in custom view
class MyARSceneView :UIView { @IBOutlet private weak var sceneView: ARSCNView! private func loadViewFromNib() -> UIView { let bundle = Bundle(for: type(of: self)) let nib:UINib = UINib(nibName: self.nibName, bundle: bundle) // Assumes UIView is top level and only object in CustomView.xib file let view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView return view } .... }
ARViewContoller:
class ARViewController : UIViewController { @IBOutlet weak var arSceneView: FBARSceneView! override func viewDidLoad() { appDelegate.enableAllOrientation = true super.viewDidLoad() } func presentARViewController() { self.annotationView = UIStoryboard.arViewController() viewController.present(annotationView!, animated: true) { self.setUpARViewController() completion?() } }
in appDeleagte:
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { if enableAllOrientation == true { return UIInterfaceOrientationMask.allButUpsideDown } return UIInterfaceOrientationMask.portrait }
after calling the presentARViewController func the new screen is shown but the camera view is in the wrong orientation.