覆盖函数错误!方法不会覆盖其超类中的任何方法
Override func Error! Method does not override any method from its superclass
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
}
override func supportedInterfaceOrientations() -> Int {
}
这里我有一个错误。它说
Method does not override any method from its superclass.
多次出现,我无法修复。
你知道吗?
错误来了,因为你的方法签名与实际的不同。您应该使用确切的方法签名进行覆盖(您应该使用 Xcode 中提供的自动完成功能或参考文档)
override func touchesBegan(_ touches: Set<UITouch>,
with event: UIEvent?)
{
}
在Swift 3中supportedInterfaceOrientations不再是一个方法,它是一个计算的属性,所以它的签名变成:
override var supportedInterfaceOrientations : UIInterfaceOrientationMask
{
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
}
override func supportedInterfaceOrientations() -> Int {
}
这里我有一个错误。它说
Method does not override any method from its superclass.
多次出现,我无法修复。
你知道吗?
错误来了,因为你的方法签名与实际的不同。您应该使用确切的方法签名进行覆盖(您应该使用 Xcode 中提供的自动完成功能或参考文档)
override func touchesBegan(_ touches: Set<UITouch>,
with event: UIEvent?)
{
}
在Swift 3中supportedInterfaceOrientations不再是一个方法,它是一个计算的属性,所以它的签名变成:
override var supportedInterfaceOrientations : UIInterfaceOrientationMask
{
}