【发布时间】:2015-06-17 12:54:57
【问题描述】:
XCode 6 中的此代码没有错误,但在 XCode 7 (Swift 2) 中出现此错误:
方法不会覆盖其超类中的任何方法
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
/* Called when a touch begins */
}
当删除 override 字时出现此错误:
使用 Objective-C 选择器 'touchesBegan:withEvent:' 的方法 'touchesBegan(:withEvent:)' 与具有相同目标的超类 'UIResponder' 的方法 'touchesBegan(:withEvent:)' 冲突-C 选择器
【问题讨论】: