0
我想我通過點擊任何地方開箱即用打字完成後拆下鍵盤,所以我寫了這個去除鍵盤快捷
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent!) {
self.view.endEditing(true)
}
但它說,我不重寫從任何方法晚飯class.But howcome :)
我想我通過點擊任何地方開箱即用打字完成後拆下鍵盤,所以我寫了這個去除鍵盤快捷
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent!) {
self.view.endEditing(true)
}
但它說,我不重寫從任何方法晚飯class.But howcome :)
對於斯威夫特2,使用:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)
http://stackoverflow.com/questions/30892254/override-func-error-in-swift-2 –