This issue has crippled me for over a day. I need to modify the UINavigationBar's height.
The UINavigationController is created in the AppDelegate like so.
self.navigationController = [[UINavigationController alloc] initWithRootViewController:mainController];
[self.window addSubview:self.navigationController.view];
[self.window makeKeyAndVisible];
The height of the navbar WILL change and stick if I add [self.navigationController.navigationBar setFrame:newFrame] to viewDidAppear like the code below.
- (void)viewWilAppear:(BOOL)animated
{
[super viewWillAppear:animated];
CGRect newFrame = CGRectMake(0, 0, 320, 100);
[self.navigationController.navigationBar setFrame:newFrame]
}
HOWEVER, if I do it this way, you can actually see the frame snapping from the original 44px to a 100px height in the split second that the view loads, which is very annoying.
I've tried adding the [navBar setFrame:] to viewDidload, viewWillAppear of the rootViewController and also the AppDelegate just after I initiate the UINavigationController. None of these work.
Just so you know, I've overridden the drawRect:(CGRect)rect method in a UINavigationBar category to make the background color solid black using the code below but I don't think that has something to do with the problem.
[[UIColor blackColor] set];
CGContextFillRect(UIGraphicsGetCurrentContext(), rect);
Does anyone know the best way to do this?