(ragh, i'm apparently not allowed to post images, so i have included links to the images in this post instead of embedding them)
Im writing an iPhone application based on the navigation controller template, but I am not loading the actual navigation controller as the first view in the window. I create a new view controller from a xib, and then add that as a subview, and then only push the navigation view as a modal when i need it. Here's my application: didFinishLaunching ... method in the application deleate
RootViewController *rootViewController = (RootViewController *)[navigationController topViewController];
rootViewController.managedObjectContext = self.managedObjectContext;
mainViewController = [[MainViewController alloc] initWithNibName:@"MainViewController" bundle:[NSBundle mainBundle]]; mainViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[window addSubview:[mainViewController view]]; [[mainViewController view] setNeedsLayout];
[window makeKeyAndVisible];
return YES;
It works but the view is not properly aligned with the statusbar:
When i click "my ambiances" and push the navigation controller view, and then dismiss it again, the layout is fine:
same link as above, just replace the 1 with a 2. Sorry for the hassle, apparently I can also only post one link....
Here's the code I use for presenting/dismissing the navigationcontroller:
-(void)pushMyAmbiences {
[mainViewController presentModalViewController:navigationController animated:TRUE];
}
-(void)returnToMainView {
[mainViewController dismissModalViewControllerAnimated:TRUE];
}
Is there anything I'm missing here? Layout-wise? Something that needs to be set in the xib? In a vain attempt I tried calling setNeedsLayout on the view, no luck. Any help is greatly appreciated!