0

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

casparjespersen
  • 3,460
  • 5
  • 38
  • 63

1 Answers1

3

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

Community
  • 1
  • 1
Bonnie
  • 4,943
  • 30
  • 34