Is it possible to programmatically rotate navBar on rotation in objective-c, when Device Orientation in Deployment info is set to Portrait only?
CodePudding user response:
- Set the allowed orientations to both Portrait & Landscape in your project settings
- Set all your view controllers to allow only portrait orientation and no rotation
- On the view controllers that require landscape set the preferred orientation to landscape.
override public var shouldAutorotate: Bool {
return false
}
override public var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return .landscapeRight
}
override public var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return .landscapeRight
}
}