0

I'm writing a Cordova plugin, which simply presents a UIView controller. I can lock the orientation of that UIView, but can I also lock its parent's orientation?

in main Cordova class:

self.storyboard = UIStoryboard(name: "myuiview", bundle: nil)
self.myView = self.storyboard?.instantiateInitialViewController() as? myViewController
self.viewController.present(self.myView!, animated: true) { _ in }

in myViewController:

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return .portrait
}

override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
    return .portrait
}

This locks the orientation of current myViewController. However when I rotate the device and then dismiss myViewController, the orientation of the app still changed

vincentf
  • 1,419
  • 2
  • 20
  • 36

1 Answers1

0

I think below post also resolves your issue.

You can revise @bmjohns's answer

How to lock orientation of one view controller to portrait mode only in Swift

Dipak Kacha
  • 423
  • 2
  • 13