Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

what to do?

dickthedevdickthedev Posts: 214Registered Users @ @
Hello, I am learning to use auto layout by code w/o storyboard. I found this link:
https://makeapppie.com/2014/07/26/the-swift-swift-tutorial-how-to-use-uiviews-with-auto-layout-programmatically/
It is a good post but unfortunately it is a bit out of date for Xcode 8 Swift 3, so there are a bunch of syntax I had to fix to get rid of the warnings and errors.

But here is one line I don't seem to ba able to fix, this line:
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.all
}
I got an error "Method does not override any method from it's superclass

When I delete the override keyword I got another error "Method 'supportedInterfaceOrientations()' with Objective-C selector 'supportedInterfaceOrientations' conflicts with getter for 'supportedInterfaceOrientations' from superclass 'UIViewController' with the same Objective-C selector"
this function
func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.all
} seems very much Swift, why does it get me this error? And how to fix it? Thanks.

Replies

Sign In or Register to comment.