我是新來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 –