0
votes

I have a UITextField inside a UIViewController which is pushed onto a UINavigationController stack. The UINavigationController is presented as a modalViewController.

If the text field has firstresponder status (i.e. keyboard is up) when the back button is tapped, the view pops like it should, but it causes nav bar errors for every other view controller in the stack: The "Back" buttons on the nav bar have the wrong text color and no backing image, the titles disappear, and tapping other custom nav bar buttons has no effect.

I've tried resigning the text field's firstresponder status in viewWillDisappear: and viewDidDisappear:.

1
Im curious, does this only happen in the simulator but work on the device?chown
@chown It happens on simulator and device.user756365
Ah, then what I was going to suggest doesn't apply, sorry =/.chown

1 Answers

0
votes

Try the following instead

In the viewController instead of 'pushing' the modalViewController onto the NavigationController just call

[self presentModalViewController:self.myModalViewController animated:YES];

Then when you want to get rid of it (e.g. in a button in the top left of the view ) have an action in MyModalViewController that is called e.g.

- (IBAction)doneAction {
    [self dismissModalViewControllerAnimated:YES];
}