简体   繁体   中英

Lock UIViewController orientation on iPad

Is exist any way to lock screen orientation for one of UIViewControllers in iPad application without selecting Requires full screen ?

I know that Requires full screen is for iPad multitasking mechanism. Tell me if it is true. I must choose between multitasking and locking one of the screens? Can I have both of these things?

Image here In General info of your app Deselect both landscape modes and select only portrait mode

By Default all apps are any orientation compatible. You can choose orientation in General > Deployment info.

Why not implementing

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.portrait
}

in the UIViewController that should stay in eg portrait mode.

Or do

override var shouldAutorotate: Bool {
   return false
}

You might want to do that in your surrounding UINavigationController though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM