[英]Dismiss UIAlertController keyboard in Swift 2.3
我最近升级到最新的Xcode版本,并将项目转换为Swift 2.3。 直到2.2,当我显示UIAlertController
我用经典的键盘将其UIAlertController
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?){
view.endEditing(true)
super.touchesBegan(touches, withEvent: event)
}
好吧,它不再起作用了。 试图更改UIKeyboardType
的UIKeyboardType
和returnKeyType
。 没运气。 有什么想法吗?
尝试对视图使用tapGesture识别器。 试用此链接
或者您可以尝试以下代码:
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)
{
super.touchesBegan(touches, withEvent: event)
view.endEditing(true)
}
希望这可以帮助你。 快乐编码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.