自动大写类型不起作用
我试图通过设置 autocapitalizationType 来保留 textFiled“Capital”的第一个字符,但它不起作用。下面是相同的 src 代码的快照。
UITextField* returnTextField = [[UITextField alloc] initWithFrame:frame];
returnTextField.autocorrectionType = UITextAutocorrectionTypeNo;
returnTextField.autocapitalizationType = UITextAutocapitalizationTypeWords;
returnTextField.keyboardType = UIKeyboardTypeEmailAddress;
returnTextField.returnKeyType = UIReturnKeyGo;
returnTextField.clearButtonMode = UITextFieldViewModeWhileEditing;
returnTextField.delegate = self;
谢谢,
萨加尔
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.clearButtonMode = UITextFieldViewModeWhileEditing;
returnTextField.delegate = self;
Thanks,
Sagar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我发现如果你关闭自动更正,那么自动大写也不起作用。在我看来,他们应该独立运作。在名称字段中,人们希望将每个单词大写,但不会自动用字典预测的任何内容替换名称。
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.
如果您使用硬件键盘在文本字段中键入内容,它将忽略自动大写。但是,如果您在模拟器屏幕上使用键盘,它应该自动将单词大写。
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.
我还发现您应该使用
Default
键盘,而不是受限键盘,例如Name Phone Pad
I also find that you should be using the
Default
keyboard as opposed to restricted keyboards e.g.Name Phone Pad