我是新来iOS
,的UITextField更改键盘
我想改变留在UITextField
某些字符后,键盘,
为如:我有@"AEBPQ1234M"
字符串第5个字母我想字母键盘,然后为接下来的4个字母我需要数字键盘和最后一个字母,我需要再次字母表。
这里是我尝试过的代码,但是当我在键盘中弹出退格键时它不工作。
-(void)textFieldDidChange :(UITextField *)theTextField{
if (theTextField.text.length < 5 || theTextField.text.length >= 9) {
[theTextField setKeyboardType:UIKeyboardTypeEmailAddress];
}
if (theTextField.text.length >= 5 && theTextField.text.length < 9) {
[theTextField setKeyboardType: UIKeyboardTypeNumberPad];
}
[theTextField reloadInputViews];
}
我在哪里犯错?
在其他情况下工作?,尝试使用'textfieldshouldchangecharactersinrange'委托 –
这并不是理想的方式。你不应该改变键盘。这不是很好的用户体验。 –
可以请你帮我拿到代码我是新来的iOS –