代码之家  ›  专栏  ›  技术社区  ›  Zigglzworth

在UITextView上设置UITextContentType.emailAddress无效

  •  0
  • Zigglzworth  · 技术社区  · 7 年前

    我有一个 UITextView 使用UIKeyboardType.emailAddress设置 UITextContentType

    我喜欢这样:

    if #available(iOS 10.0, *) {
                            myTextView.textContentType = UITextContentType.emailAddress
                        }
    

    但是这不起作用,我在textview的建议框中没有看到电子邮件。

    我也用UITextField尝试过同样的方法,但没有骰子。 我有什么遗漏吗?我已经按照文件做了一切。 enter image description here

    1 回复  |  直到 7 年前
        1
  •  7
  •   Daniel    7 年前

    确保您已在“联系人”应用程序中的自己的联系人卡中设置了电子邮件地址。

    :)

        2
  •  1
  •   Zoltán    6 年前

    如果是电子邮件地址,您需要设置 keyboardType emailAddress 而且

    textField.autocorrectionType = .yes
    textField.textContentType = .givenName
    textField.keyboardType = .namePhonePad