Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Background Image to UINavigationController among multiple views

How can I use a background image for UINavigationController, while maintaining the title? The answer from ck on other thread did the trick to put the image and keep the text. But if the user navigates to other view ( using [navigationController pushViewController]), only the background appears in the new screen.

How can one change the background image for UINavigationController, while maintaining the title across multiple views?

like image 983
Johnny Everson Avatar asked Apr 20 '26 22:04

Johnny Everson


1 Answers

create a CustomUIViewController that extends UIViewController and override viewDidLoad to something like this:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg.png"]];
}

After that, use your CustomUIViewController in your controllers.

like image 70
Johnny Everson Avatar answered Apr 23 '26 12:04

Johnny Everson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!