迅速如何在uitextfield中建议用户电子邮件自动完成 [英] swift how to suggest user email in uitextfield as autocomplete
问题描述
我不想显示自动填充字词,而是想显示用户电子邮件的自动填充字词,例如example@domain.com
Rather than showing autocomplete words I would like to show the autocomplete of the user emails for example example@domain.com
如果我转到 https://www.superbru.com/beta/register,则会发生这种情况.php 在Safari中,我会在自动填充框中找到我建议的电子邮件地址.
This happens if I go to https://www.superbru.com/beta/register.php in Safari I get my email address suggested to me in the autocomplete box.
这是我设置文本字段的方式,但是仍然没有电子邮件提示.
This is how I set up my textfield but still no email being suggested.
private let emailTextField: UITextField = {
let textField = UITextField()
textField.height(equalTo: 45)
textField.keyboardType = .emailAddress
textField.returnKeyType = .done
textField.placeholder = "E-mail"
textField.addTarget(self, action: #selector(textFieldTextDidChange), for: .editingChanged)
return textField
}()
并设置autocorrectionType = .default或yes也不起作用.
and setting autocorrectionType = .default or yes does not work either.
推荐答案
将textContentType设置为emailAddress
Set textContentType to emailAddress
let textField = UITextField()
textField.textContentType = .emailAddress
这篇关于迅速如何在uitextfield中建议用户电子邮件自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!