上下文非常简单,有一个带有文本字段的 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/