0

What is the easiest way to change UINavigationBar background image and make the main UINavigationBar to scale to the background image size?

I designed a navigation bar that is not the size of my table view controller navigation bar, and now I imported the image to Xcode and I want to do something like:

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"BG.png"] forBarMetrics:UIBarMetricsDefault];

but that does not work, anyway I think that this way I will have a problem with the height since my designed nav is bigger.

How can I do this please?

Stuart
  • 36,683
  • 19
  • 101
  • 139
nick shmick
  • 905
  • 1
  • 9
  • 25

1 Answers1

1

It's better to not do that, there are some hacks than you can do, for example hide navigation bar and create a personalized bar with the height you want.

Check this post: https://stackoverflow.com/a/7533098/4559321

I recommend to change your design to fit with the standard UINavigationBar and you will save lot of work.

Community
  • 1
  • 1
peig
  • 418
  • 3
  • 11