Why is the AutorotateToInterfaceOrientation method marked as not available?

I put this code in subclasses of UIViewController:

override func shouldAutorotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation) -> Bool {
    return true
}

      

and I am getting this compile time error:

Cannot override 'shouldAutorotateToInterfaceOrientation' which was marked as not available

What is the problem? how can i solve this?

+3


source to share


2 answers


Use this code -

override var shouldAutorotate: Bool {
    return true
}

      



Hope this helps!

+1


source


shouldAutorotateToInterfaceOrientation

used when using shouldAutorotate()



+8


source







All Articles