Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextField becomeFirstResponder Issue for tab key(Keyboard) action

I have a view in XIB where i used several text fields in it. Let say the first text field becomes first responder as soon as the view gets loaded in the window. If i press tab key in my machine's keyboard to navigate to next text field ;apart from the immediate text field, all other text fields are also becomes first responder and the textfield begin editing delegate menthod gets called for all the text fields. What could be the issue ? This will occur not only in simulator when we use machine's keyboard also when we use bluetooth keyboard for a iOS device.

like image 404
Balaji Avatar asked Mar 06 '12 12:03

Balaji


1 Answers

Pressing of tab key => navigation to next textfield with respect to heirarchy of the textfields in the view.

When u press tab - textfieldshouldbeginediting will be called as many times as you textfields - meaning - 5 textfields => one tab key press, all the 5 instances will be called. When you press tab - textfielddidbeginediting will be called only once with respect to the new textfield's instance - Hence any logic for the textfield is better to be in textfielddidbeginediting delegate method.

These are the default characteristics of the delegate methods and not an issue.

like image 174
Ashwin G Avatar answered Oct 12 '22 10:10

Ashwin G