In our app, there's a situation where the user enters something in a textbox and then presses the back button to go back to the master screen.
If we run that on iOS 7, the keyboard does not disappear, it just stays there. The user can still navigate through the app, but all text fields are disabled, meaning you can't enter text anywhere. The only option the user has is killing the app and starting fresh.
We tried to add resignFirstResponder
messages, but that didn't help anything.
There's much code involved, and we're actively working on the issue. Meantime, has anyone experienced that problem too, and maybe found a way to make it go away?
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]
in viewWillDisappear
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 respond resignFirstResponder
:
- (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];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With