iOS 关闭键盘的联想功能

加入你只想输入字母,数字而不能输入汉字,如图:

 

textfiled实现代码:

 

_loginField.keyboardType = UIKeyboardTypeAlphabet;

    [_loginField setDelegate:self];

在代理方法中实现如下代码:

- (void)textFieldDidBeginEditing:(UITextField *)textField
{
    if ([textField isEqual:_loginField]) {
        textField.autocorrectionType=UITextAutocorrectionTypeNo;
    }
}

 

posted @ 2016-05-03 11:27  MaricoSun  阅读(2183)  评论(0)    收藏  举报