Reputation: 327
I've added toolbar to the textfield and also on textfield it can show keyboard or show UIPickerView like on image
How to move cursor/focus from on textfield to other textField programmatically(Next, and Back buttons on Toolbar)?
P.S. I know how to call the method(set selector when adding UIBarButtonItem to Tool). I just need the code for moving the focus/cursor
Upvotes: 0
Views: 1365
Reputation: 80811
Use the UIResponder
methods -resignFirstResponder
& -becomeFirstResponder
on the respective UITextField
objects to lose and gain focus respectively.
For example:
[nextTextField becomeFirstResponder];
Upvotes: 3
Reputation: 46
To move focus to another responder you can use[textField2 becomeFirstResponder];
. I can also suggest a IQKeyboardManager library which adds a similar toolbar automatically.
Upvotes: 1