Maxim Tsybanov Maxim Tsybanov - 1 month ago 7
Swift Question

shouldAutoRotate not working in swift

I know if VC has

navigationController
it should contain some like this. But what about swift? How to able call
shouldAutoRotate
in VC with
navigationController
? My
navigationController
s has standard class
UINavigationController
(not custom). I want make
shouldAutoRotate
false for all my VC except single. As I understood there no another ways to just use "Portrait" and make available to rotate single VC

Answer

Put this in your view controllers:

override func shouldAutorotate() -> Bool {

     return false // or true for the VC that allows landscape
}
Comments