我想为文本字段做自动完成,例如电子邮件。
我在网上搜索了一下,没有找到swift的版本,很多demo都是用tableview
来显示结果的。
我的问题是:
1 : 我不想用 tableview
来显示结果,我想像 safari 那样做,当你写东西时,结果是灰色的并完成句子。
2:我想为 UIAlertController
的文本字段执行自动完成。我的 UIAlertController
文本字段代码是
let ac = UIAlertController(title: "Enter e-mail", message: nil, preferredStyle: .Alert)
ac.addTextFieldWithConfigurationHandler(nil)
let submitAction = UIAlertAction(title: "Send", style: .Default) { [unowned self, ac] (action: UIAlertAction!) in
self.dismissKeyboard()
}
最佳答案
如果文本框是通过 Storyboard添加的,那么点击文本框
然后选择AtrributeInspector -> change correction -> yes
这将用于自动更正
谢谢,
关于swift - 如何在 swift 中对 UIAlertController 的文本字段进行自动完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37961657/