提问人:nirav 提问时间:2/28/2017 更新时间:2/28/2017 访问量:411
在iOS中使用外部键盘控制“Tab键”
Control "Tab key" with External Keyboard in iOS
问:
我有一个包含 3-4 个文本字段的屏幕。其中一个文本字段在尝试编辑时显示警报。
但是当我尝试编辑其他文本字段并通过外部键盘按 Tab 键时,该警报将始终显示。
我的代码
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
func textFieldShouldBeginEditing (_ textField: UITextField) -> Bool {
if textField == txt_a {
let alertController = UIAlertController(title: "Custom TextField", message: "Do your custom work here", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .cancel, handler: nil))
self.present(alertController, animated: true, completion: nil)
//self.present(alertController, animated: true, completion: nil)
return false
}
return true
}
那么,如何控制/检测 Tab 键?
谢谢
答: 暂无答案
评论