casparjespersen
casparjespersen

Reputation: 3870

Setting the height of the UINavigationBar

I have set a UINavigationBar background image to an image with a height of 68px as opposed to the default 44px. Now the image is shown fine, but the content in the UINavigationController is overlapped in the first (68-44)px = 12px by the header image.

How do I fix this? I have tried setting the frame of the UINavigationBar without luck.

Thanks, Caspar.

This is my code (AppDelegate.m):

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self.frontTableViewController];
UINavigationBar *navBar = navigationController.navigationBar;
[navBar setBackgroundImage:[UIImage imageNamed:@"header"] forBarMetrics:UIBarMetricsDefault];
self.window.rootViewController = navigationController;

Image showing the problem

Upvotes: 0

Views: 1888

Answers (1)

Bonnie
Bonnie

Reputation: 4953

try setting the image for the navigationbar this way

self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myNavBarImage.png"]];

or have a look at this Answer

Upvotes: 3

Related Questions