Ios Error Swift Method不会覆盖其中的任何方法';超级级
因此,我正在编写一个教程,我已经完成了它,当我更新到xcode 7时,我所有的代码都被bug弄得乱七八糟 在上面的文章中,我得到了一个错误“method不重写其超类中的任何方法”,但当我删除重写时,我得到了这个错误:带有Objective-C选择器的方法'SupportedInterfaceOrientions()'与方法'SupportedInterfaceOrientions()冲突'来自具有相同Objective-C选择器的超类'UIViewController' 我一直在研究,但我对编程很陌生,这里的很多答案我都不太了解,不适合我的情况Ios Error Swift Method不会覆盖其中的任何方法';超级级,ios,swift,error-handling,superclass,Ios,Swift,Error Handling,Superclass,因此,我正在编写一个教程,我已经完成了它,当我更新到xcode 7时,我所有的代码都被bug弄得乱七八糟 在上面的文章中,我得到了一个错误“method不重写其超类中的任何方法”,但当我删除重写时,我得到了这个错误:带有Objective-C选择器的方法'SupportedInterfaceOrientions()'与方法'SupportedInterfaceOrientions()冲突'来自具有相同Objective-C选择器的超类'UIViewController' 我一直在研究,但我对编程
谢谢它不再返回
Int
。新方法签名需要返回UIInterfaceOrientationTask
override func supportedInterfaceOrientations() -> Int {
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue)
} else {
return Int(UIInterfaceOrientationMask.All.rawValue)
}
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
if UIDevice.currentDevice().userInterfaceIdiom == .phone {
return UIInterfaceOrientationMask.allButUpsideDown
} else {
return UIInterfaceOrientationMask.all
}
}