Objective-c – Use Background Image to UINavigationController among multiple views

cocoa-touchiphoneobjective cuinavigationcontrolleruiviewcontroller

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?

Best Answer

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.

Related Topic