views:

210

answers:

4

i want to send the keypad back after writing in textfield.

+2  A: 

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;
}
Jasarien
its not working.can u tell me how to put the done button in keypad
uttam
You need to ensure that you set the delegate property of the text field to point to the instance of the class that you implemented the method in.Also, you can set the `returnKeyType` on the textField to `UIReturnKeyTypeDone`
Jasarien
A: 
- (IBAction)textFieldDoneEditing:(id)sender{ 
    [sender resignFirstResponder]; 
}

connect this to didEndOnExit action of your textfield

Nithin
A: 

You need to set the delegate of the textfield to fileowner (using interface builder) first. then you implement the method:

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

it will work!

Roberto
A: 

hello,

this method works fine with simple view,but as soon as i use the same code in the table view,the keypad is not disabled.

actually i am fetching data from the table view using textfield,but the keypad cannot be disabled.

Can anybody help me out?