UINavigationController placement problem
Posted
by Chonch
on Stack Overflow
See other posts from Stack Overflow
or by Chonch
Published on 2010-03-21T09:31:58Z
Indexed on
2010/03/21
9:41 UTC
Read the original article
Hit count: 510
Hey,
I'm having this problem and I can't seem to figure out why! I want to use a UINavigationController, but I don't want to use it through out the entire application. So, in the UIViewController I was to add it to, I define:
UINavigationController *navigationController;
and the @property, @synthesize and dealloc. In the viewDidLoad method, I add:
navigationController = [[UINavigationController alloc] init];
navigationController.navigationBar.barStyle = UIBarStyleBlack;
and when the relevant UIViewController is loaded, I add:
[navigationController pushViewController:viewController animated:NO];
and make the old view disappear and the UINavigationController's view to appear.
Everything works fine except that the navigation bar appears about 20pixels too low (dragging the entire view down and out of the screen). If I set the UINavigationController's view frame parameter manually to start at 0,0, it jumps there, but only after about a second, so that you can see the navigation bar starting at a certain location and only then jumping to another (and it is ugly!).
I have done the exact same thing in the past and had no problem with it. Does anyone know what may cause this?
Thanks,
© Stack Overflow or respective owner