【发布时间】:2016-05-25 00:18:37
【问题描述】:
我的故事板中有 UIViewController(FirtViewController)... 在分配给此 UIViewController 的 Swift 文件中,我添加了自定义 UIView
let customView = NSBundle.mainBundle().loadNibNamed("CustomView", owner: self, options: nil)[0] as! CustomView
self.view.addSubview(customView)
在这个 customView 中,我有一个 textField。 在分配给此 customView 的 swift 文件中,我具有以下功能:
func textFieldShouldReturn(textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
但是当我按下“返回键”时,我的键盘并没有隐藏!
我的错误在哪里?
【问题讨论】:
标签: swift swift2 uikeyboard resignfirstresponder