Jev*_*718 5 beta xcode ios swift xcode8
我过去曾经用过这个.
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)
{
self.view.endEditing(true)
}
Run Code Online (Sandbox Code Playgroud)
但现在在Xcode 8 beta中我收到此错误:
声明touchBegan(touches:withEvent)具有与任何潜在覆盖不同的参数名称.
有什么想法吗?
这对我有用:
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.view.endEditing(true)
}
Run Code Online (Sandbox Code Playgroud)
请注意函数参数中非常微妙的Swift 3更新.在Swift编程语言(Swift 3)的第20和21页,他们解释说:
"默认情况下,函数使用其参数名称作为其参数的标签.在参数名称前写一个自定义参数标签,或写_不使用参数标签."
:)
| 归档时间: |
|
| 查看次数: |
2495 次 |
| 最近记录: |