user648244
user648244

Reputation: 1278

how to determine if user pressed/selected a uitextfield?

Is there a way to determine if a user has selected a textfield and its active? I'm trying to implement some code this:

if(textFieldsomething.isActive)
{

}

Upvotes: 7

Views: 10854

Answers (2)

Greg
Greg

Reputation: 33650

You can check to see if the text field is editing:

if (textFieldSomething.isEditing) {
    ...
}

See the UITextField class reference for details.

Upvotes: 12

MBU
MBU

Reputation: 5098

you can implement the textFieldDidBeginEditing function to catch the action event when the text field is being edited.

-(void)textFieldDidBeginEditing:(UITextField *)textField { //Keyboard becomes visible

    //perform actions.
}

Upvotes: 12

Related Questions