Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios7 UINavigationBar backgroundImage is set upside down

I am trying to set the UINavigationBar background image:

I added in AppDelegate: (please note that it's one image)

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"general-top_bar_with_status.png"] forBarMetrics:UIBarMetricsDefault];

Since I don't need translucent, in the ViewController in ViewDidLoad I added:

self.navigationController.navigationBar.translucent = NO;

This is the image: enter image description here

Unfortunately this is what I get: enter image description here

As you can see, the image is upsite down.

What is wrong?

In storyboard, I set a place for TopBar - Opaque navigation bar

like image 709
Dejell Avatar asked Oct 06 '13 14:10

Dejell


2 Answers

For iOS 7 you have to use 320x64 size navigation bar image

like image 74
Divyam shukla Avatar answered Nov 07 '22 08:11

Divyam shukla


make picture 2X Size. with name [email protected]

Nav bar is Taking size of its self + status bar size. You may create only navbar size

640X88

or 640X128 for navbar + status bar

Then

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"mynavbar.png"] forBarMetrics:UIBarMetricsDefault];
like image 41
Anton Avatar answered Nov 07 '22 09:11

Anton