-(IBAction)settings:(id)sender
{
[mileagerate resignFirstResponder];
[mainView bringSubviewToFront:mileageView];
mainView.hidden=TRUE;
[UIView beginAnimations:@"Settings" context:nil];
[UIView setAnimationDuration:1.0];
[mainView setFrame:CGRectMake(0, 0, 320, 460)];
[UIView commitAnimations];
mileagerate.text = [[NSUserDefaults standardUserDefaults] valueForKey:@"savedstring"];
mileageView.hidden=FALSE;
}
I used resign first responder in various places in my app. But when i click on this button alone, the keyboard does not disappear. If i click on the return key in keyboard, the entered value disappears.
Use below line of code in your method if you don't know which textfield
to resign:
self.view.endEditing(true)//resign current keyboard
[self.view endEditing:YES]; //resign current keyboard
EDIT : Note : It will resign keybord
from your current view
.