Home:ALL Converter>Dismissing modal view controller

Dismissing modal view controller

Ask Time:2013-01-17T22:45:34         Author:darthyoda

Json Formatter

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.

Author:darthyoda,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14381585/dismissing-modal-view-controller
yy