Navigation Controller view is distrupted when launching modal view controller (after upgrading latest xcode/ios 5)
My name is Luca and I am experiencing an issue in my app after upgrading my XCode for ios 5. I really can find a solution to that, so I hope that someone can help me.
My software is a window-based
application that uses a navigation controller and a toolbar item. The navigation controller is connected in mainWindow.xib to the application delegate navigation controller property (IBOutlet
). The navigation controller init with a root view controller that I call 'starting view controller' (this is done in IB). The app has the status bar visible on top.
In my application delegate I do:
[application setStatusBarStyle:UIStatusBarStyleBlackOpaque];
application.statusBarHidden = NO;
self.window.rootViewController = navigationController;
[window makeKeyAndVisible];
[startingViewController onLaunchApp];
Once the app has finished loading I try to present another view using the Modal View Controller. The Modal View Controller is presented in the root view controller (starting view controller) by doing
[self presentModalViewController:'another view' animated:YES];
Here comes my issue. Once I dismiss the modal view controller, the navigation controlle开发者_如何学Gor moves on the very top of the main window pulling up with it the root view controller. Part of the navigation bar lies behind the status bar (20 px) and other 20 px of white space are left at the bottom of the root view controller. Therefore my view becomes completely messed up and the only way to fix it is to rotate the device in landscape and then back in portrait orientation. After these operations the whole views' stack is ok and if the modal view controller is presented and dismissed again everything works just fine. In other words, this problem occurs only the first time the modal view controller is dismissed.
I have tested the app with all the simulator versions and they all work correctly except for the latest 5.0.
I spent the last 6 hours reading documentation, posts and trying to fix the app, but no luck.
I would appreciate a lot if someone could help me or give me any hint.
Thank you very much in advance.
If you haven't implemented it this way, try to dismiss modal view controller from the root view controller.
精彩评论