开发者

saving text data from UITextField without pressing additional key (help needed)

I am new to iPhone programming. I am working with UITextField and UITextFieldDelegate. I have five textfields. I am trying to input data in them using numberPad keyboard. And the data should be 1 digit long. After that hitting another key开发者_如何学运维 should take it to the next textField. I have implemented it all but the only problem is when all 5 textfields are filled, I have to press keyboard 6th time to save the text data of fifth textField, Is there any way I could save the text data of 5th textfield without pressing any key on the keyboard 6th time?

Any help or suggestions are welcomed.

Thanks Vik


You can use textFieldDidChange delegate Method for 5th TextField and compare it like this.

if (textField==textField5 && [textField length]>0){

[textField resignFirstResponder];

}

I hope this will help.


Im assuming that you are using UITextFieldDelegate method to move to next text field. You can keep a count on how many text fields are entered and keep checking it:

if(count == num_of_textfields)
{
  [textField resignFirstResponder];

  //Call your method to process the input here.

}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜