uttam
uttam

Reputation: 359

iOS: how to send the keyboard down after typing in textField

I want to send the keyboard down after writing in textField.

How can I do this?

Any help would be appreciated.

Upvotes: 0

Views: 1773

Answers (3)

Roberto
Roberto

Reputation: 11

STEP-1:

You need to set the delegate of the textField to File's Owner (using interface builder)

or

textField.delegate = self; from the viewController programmatically first

STEP-2:

And you implement the method:

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

Hope this helps.

Upvotes: 1

Nithin
Nithin

Reputation: 6475

- (IBAction)textFieldDoneEditing:(id)sender{ 
    [sender resignFirstResponder]; 
}

connect this to didEndOnExit action of your textfield

Upvotes: 0

Jasarien
Jasarien

Reputation: 58448

Implement the - (BOOL)textFieldShouldReturn:(UITextField *)textField; delegate method and tell the text field to resign it's first responder status.

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

Upvotes: 3

Related Questions