How to move the curstor to a selected UIText Field in IOS Programming?

67 views Asked by At

I have created a login page with Login and Clear Button. If the clear button is pressed the text field should clear but i need the cursor, back to username textfield but it remains in Password Field. Can anyone suggest answer for this?

3

There are 3 answers

0
Caleb On

Use UIResponder's -becomeFirstResponder method:

[usernameField becomeFirstResponder];
0
ShurupuS On

In your clear method implement this:

[myTextField becomeFirstResponder];
0
kamalesh kumar yadav On

you can use like this

  -(void)yourclearMethod:(UIButton*)sender{

   [username_textfield becomeFirstResponder];
   }