iOS 8 swift : How to keep the keyboard displayed when the UIAlercontroller is presented modally?

标签 ios swift keyboard uitextfield uialertcontroller

上下文非常简单,有一个带有文本字段的 UIViewcontroller 用于输入电话号码。文本字段处于使用键盘的编辑模式。

输入号码后,用户可以点击显示警报 Controller 的按钮。由于警报以模态方式呈现,它覆盖了 UIViewcontroller 并删除了键盘,因此不再启用编辑。

因此我的问题是,应该怎样做才能使键盘显示在警报后面?

最佳答案

这个解决方案有效

let rootViewController: UIViewController = UIApplication.sharedApplication().windows[1].rootViewController!!
rootViewController.presentViewController(alert, animated: true, completion: nil)

关于iOS 8 swift : How to keep the keyboard displayed when the UIAlercontroller is presented modally?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28559162/

相关文章:

ios - RestKit RKObjectMapping 到 CLLocation

ios - 如何检测所有 CloudKit 更新何时发生?

swift - 更改 SKShapeNode 的 lineJoin

ios - 加载新数据时使缓存数据显示为响应式

python - Delphi:模拟按键以实现自动化

c# - 如何 Hook Ctrl-Alt-Tab?

ios - CGContext横竖线宽的区别

iOS 13 印尼货币格式更改 pX 为 RpX,00

ios - SwiftUI 从 var body 调用 mutating func

android - Android 2.3 模拟器上的印地语键盘问题