0
votes

Issue: When dismissing a modal view controller, the header on the presenting view controller is moved up (what looks to be around 20 pixels).

Steps to recreate: Create a tab bar controller (T), inside create a navigation controller with (N) a root view controller (A).

Setup another view controller (B) (this is the view controller to be presented modally) with a delegate so we can notify the presenting view controller (A) when it should dismiss the modal (B).

Inside the navigation controller's root view controller(A) create an instance of (B) by instantiating it from the storyboard with it's storyboard id, then present (B) with [self.tabBarController presentViewController:(B) animated:YES complition:nil];.

Have a button on (B) that when pressed triggers the delegate function to notify (A) to dismiss (B) by using [self.tabBarController dismissViewControllerAnimated:YES complition:nil];

So far all works as expected. However once the modal view controller (B) is dismissed. The navigation header on (A) is moved up about 20 pixels.

I cannot figure out why the navigation header is moving up when the modal is dismissed.

1
The status bar is there before presenting the modal, and after. I'm not sure I understand what to check for.darthyoda
I often had the same problem, it was always the status bar in different things, like orientation and status bar, xib files and status bar and so on. I can not say what to check, but i think it is a problem with status bar and or status bar orientation. Try to debug in this direction. For example disable the status bar and check if the problem occurs.Retterdesdialogs
Why do you present controller (B) from self.tabBarController? Present it from from self and see if it changes something.Alexander N.
Tried that, same outcome. Still messing around with Retterdesdialogs suggestion.darthyoda
If I disable the status bar it works fine. However, I would like to keep the status bar if at all possible.darthyoda

1 Answers

0
votes

In the presenting viewController add following code to the

-(void)viewDidAppear:(BOOL)animated method:

[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];