ios - How to Move UITextFeild Cursor to Next Text Field -
i have 3 text fields , want able move cursor next one. when last 1 reached, keyboard dismisses. nothing works me... here's example of have. however, nothing moves, , nothing happens when select next button.
- (bool)textfieldshouldreturn:(uitextfield *)textfield { if (textfield == field1textfield) { [textfield resignfirstresponder]; [field2textfield becomefirstresponder]; } else if (textfield == field2textfield) { [textfield resignfirstresponder]; [field3textfield becomefirstresponder]; } else if (textfield == field3textfield) { [textfield resignfirstresponder]; } return yes; }
the object method bound should set text field's delegate. check setting breakpoint in method verify called when think is.
if using nibs or storyboards, field... instance variables should outlets correctly hooked up. if created programmatically, should ensure have objects assigned them. verify inspecting values of these variables when inside method.
you don't have call resignfirstresponder on other controls before calling becomefirstresponder on another.
Comments
Post a Comment