我有一个带有 TextField 的应用程序。如果 TextField 为空,则通过一个按钮显示 UIAlertView
。当用户点击 UIAlertView
中的按钮时,他必须返回到 TextField。
为此,我正在使用 self.TextField.becomeFirstResponder()
。有用。但问题是键盘显示真的很慢。看起来在显示之前有一秒钟的延迟。
if TextField.text?.isEmpty ?? true {
let alert = UIAlertController(title: "Title", message: "Text", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Okay", style: .cancel, handler: { (action: UIAlertAction!) in
self.TextField.becomeFirstResponder()
}))
self.present(alert, animated: true)
print("textField is empty")
} else { ...
最佳答案
关于ios - 键盘在 iOS 中运行非常缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50328805/