我尝试在viewcontroller中实现两种方法
override func shouldAutorotate() -> Bool {
return false
}
override func supportedInterfaceOrientations() -> Int {
return UIInterfaceOrientation.Portrait.rawValue
}
但我不能,因为我收到第二种方法的错误,上面写着
Method does not override any method from its superclass
如果我删除 override 关键字,我还会收到一条错误消息
我该怎么办?
最佳答案
Swift 2.0 的新语法:
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.Portrait
}
检查Documentation了解更多信息。
关于ios - 方法不会覆盖其父类(super class)中的任何方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32966671/