3
votes

I am facing a very strange issue on iOS 6.0 & iOS 6.0.1.

Whenever I present a modal view from any view controller and then dismiss that modal view, the navigation bar of my parent view controller (from where I presented the modal view) overlaps by the status bar. This is working fine on iOS 6.0 & iOS 6.1 Simulators but on devices it messes up.

My Xcode version is 4.6.

This is how I am presenting my Modal:

UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:iViewController];
[aNavigationController.navigationBar setBarStyle:UIBarStyleBlack];
[self presentModalViewController:aNavigationController animated:YES];
[aNavigationController release];

This is how I am dismissing my Modal:

[self dismissModalViewControllerAnimated:YES];

Please see the attached screenshot of my nav bar after dismissing the modal:

enter image description here

1

1 Answers

3
votes

I got it fixed. This was because when my RootViewController launches it holds off on rotations until the animation is done. Once it is done, then it allows rotations again. The problem was that it was returning NO for all aspects (including portrait). The view showed fine but when I would present a modal and return, the view geometry was mangled. Once I changed it to return YES for portrait mode even during animation, the problem went away.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)iOrientation {
    return (iOrientation == UIInterfaceOrientationPortrait);
}