开发者

autocapitalizationType Not working

I am trying to keep the first charactor of textFiled "Capital" by setting autocapitalizationType but it is not working. below is snapshot of src code for same.

UITextField* returnTextField = [[UITextField alloc] initWithFrame:frame];
returnTextField.autocorrectionType = UITextAutocorrectionTypeNo;
returnTextField.autocapitalizationType = UITextAutocapitalizationTypeWords;
returnTextField.keyboardType = UIKeyboardTypeEmailAddress;
returnTextField.returnKeyType = UIReturnKeyGo;
returnTextField.开发者_C百科clearButtonMode = UITextFieldViewModeWhileEditing;  
returnTextField.delegate = self;

Thanks,

Sagar


If you type in the text field using your hardware keyboard, it ignores auto capitalization. However if you use the keypad on the simulator screen, it should auto-capitalize the words.


I had the same issue, problem goes from Device settings, if you turn off Autocapitalization on device Settings->General->Keyboard then it will affect on all your applications.


I also find that you should be using the Default keyboard as opposed to restricted keyboards e.g. Name Phone Pad


I found that if you turn off autocorrection then auto-capitalization doesn't work either. Seems to me that they should operate independently. In a name field one would want to capitalize every word but not replace a name automatically with whatever the dictionary predicts.


Comment the following line and try.

returnTextField.autocorrectionType = UITextAutocorrectionTypeNo;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜