vzm
vzm

Reputation: 2450

Issued changing the navigationbar image?

Currently, I am able to change the tint of the my UINavigationBar by

self.navigationController.navigationBar.tintColor  = [UIColor colorWithRed:74/255.0f green:74/255.0f blue:74/255.0f alpha:1.0f];

However when I try to implement the following code to change the image of the UINavigationBar all together, I see no results..

 UIImage *navImageBackground = [[UIImage imageNamed:@"texturedNav"] //This being my .png image
                                resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];



    [[UINavigationBar appearance] setBackgroundImage:navImageBackground
                                       forBarMetrics:UIBarMetricsDefault];

What am I doing wrong here?

Upvotes: 0

Views: 44

Answers (1)

Wain
Wain

Reputation: 119041

You're probably calling the appearance delegate after the navigation bar is already on screen so your request is being 'ignored'. Or, at least, not causing a UI update.

Set the appearance before the navigation bar is shown. Or, force a UI refresh by hiding and showing the navigation bar (without animation).

Upvotes: 2

Related Questions