2017-06-14 63 views
1

我正在尝试在用户正在编辑电子邮件文本字段以及电子邮件确认文本字段时显示用户电子邮件地址的快速类型建议。为此,我设置了两件事: 文本字段的textContentType以及其autocorrectionType以获得快速类型栏出现。UITextContentTypeEmail对UITextField上的快速类型建议没有影响

但是,似乎设置textContentType对快速类型栏的内容没有影响;它只是显示“单词”,因为它们会在编辑任何其他文本字段时出现。这显然不是我希望我的用户看到的结果。

下面是当前的代码:

SEL selector = NSSelectorFromString(@"textContentType"); 
    // Make sure that the text field is actually able to process the event, 
    // the iOS version is greater than 10.3 
    if([self.emailTextField respondsToSelector: selector]){ 
     self.emailTextField.textContentType = UITextContentTypeEmailAddress; 
     self.emailConfirmationTextField.textContentType = UITextContentTypeEmailAddress; 
     self.emailTextField.autocorrectionType = UITextAutocorrectionTypeDefault; 
     self.emailConfirmationTextField.autocorrectionType = UITextAutocorrectionTypeDefault; 
    } 

回答

0

从我读过,这适用于第三方应用程序只能从IOS首发11