ios - 键盘在 iOS 中运行非常缓慢

标签 ios swift keyboard

我有一个带有 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 { ...

最佳答案

确保在 Debug 菜单中禁用了 Slow Animation:

enter image description here

关于ios - 键盘在 iOS 中运行非常缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50328805/

相关文章:

swift - Swift 构建中的类型检查规则?

iOS Swift 中断键盘事件

ios - 调用Webservice时键盘关闭强制

ios - 将 NSMutableArray 传递给 Swift 中的另一个对象

ios - 无法异步显示数据swift2,tableView在检索数据之前正在刷新

ios - 函数在异步请求完成之前返回

ios - 如何向从 nib 文件加载的 subview 添加约束?

ios - swift - 背景音乐和转场

ios - UITableViewDataSource 导致 libc++abi.dylib : terminating with uncaught exception of type NSException

Android - 键盘压缩我的 View