I had the same issue like you when I compiled the app for iOS 7 and I did the following changes:
Make sure you add
[textfield resignFirstResponder]
before dismissing the viewController for example:[_passwordInput resignFirstResponder]; [_emailInput resignFirstResponder]; [self performSegueWithIdentifier:@"forgotPassword" sender:self];
Just to be sure the keyboard disappears add
[textfield resignFirstResponder]
inviewWillDisappear
for example :- (void) viewWillDisappear:(BOOL)animated { [_passwordInput resignFirstResponder]; [_emailInput resignFirstResponder]; }
If your viewController is presented using
UIModalPresentationFormSheet
add this to your viewController just to make sure the textfields will respondresignFirstResponder
:- (BOOL)disablesAutomaticKeyboardDismissal { return NO; }
In your case, override the back button action or just use viewWillDisappear
to check when the user pressed the back button and then call resignFirstResponder
before [super viewWillDisappear]
something like this:
-(void) viewWillDisappear:(BOOL)animated
{
[_passwordInput resignFirstResponder];
[_emailInput resignFirstResponder];
[super viewWillDisappear:animated];
}