2015-11-13 269 views
0

我想我通過點擊任何地方開箱即用打字完成後拆下鍵盤,所以我寫了這個去除鍵盤快捷

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent!) { 
     self.view.endEditing(true) 
    } 

但它說,我不重寫從任何方法晚飯class.But howcome :)

+0

http://stackoverflow.com/questions/30892254/override-func-error-in-swift-2 –

回答

0

對於斯威夫特2,使用:

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)