My app has a custom navigation bar that is 59 (virtual) pixels tall, as opposed to the 44 pixels of the standard Apple UINavigationController UINavigationBar. I'm applying the styling to the bar with the following call during app startup:
UIImage *navBarImage = [UIImage imageNamed:@"navigation-bar.png"];
[[UINavigationBar appearance] setBackgroundImage:navBarImage
forBarMetrics:UIBarMetricsDefault];
The problem this leads to is that it's basically an image slapped on top of the screen at the origin of the standard navigation bar. The underlying navigation bar has no idea that its size has changed. This makes the content views (the view pushed onto the navigation stack) show up 15 pixels under the custom bar.
I couldn't find a way of changing the size and position of the UINavigationController's navigation view.
What is the most elegant way of accounting for this customization? The following (not elegant) works, BUT because the operations are applied after the view has been rendered, the shift in position and resizing is very visible to the user and looks quite amateurish:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
CGRect frame = self.view.frame;
self.view.frame = CGRectMake(frame.origin.x, frame.origin.y + 15, frame.size.width, frame.size.height - 15);
}
All of the controllers pushed onto the navigation stack are in a subclass of UIViewController that implements the method above.
Thanks a bunch!