amitsbajaj
amitsbajaj

Reputation: 1304

Custom UINavigationBar Background Working on all Navigation Controllers Except One

I have a series of view controllers connected by a root navigation controller. All of the view controllers are table views, except one which is a view controller.

I have a custom navigationBar image which I've applied in the App Delegate and it works great everywhere, except this one view controller. With this, when the segue happens (Push), it almost super imposes the custom background with another image and the result is a darker uinavigationBar.

My code in the App Delegate is:

UIImage *nav = [UIImage imageNamed:@"Purple.png"];
[UINavigationBar appearance] setBackgroundImage:nav forBarMetrics:UIBarMetricsDefault];

Does anyone have any ideas for what I can do to ensure this view controller maintains the correct custom UINavigationBar?

In the viewDidLoad of this view, I've even tried to set this:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"Purple.png"] forBarMetrics:UIBarMetricsDefault];

I also tried this in the viewWillAppear but nothing - still that darker image.

Any thoughts would be greatly appreciated!

Upvotes: 0

Views: 94

Answers (1)

thorb65
thorb65

Reputation: 2716

you wrote this wrong

UIImage *nav = [UIImage imageNamed:"@Purple.png@];

replace that with this

UIImage *nav = [UIImage imageNamed:@"Purple.png"];

Upvotes: 0

Related Questions