Background Image for UINavigationcontroller

I want to add a background image to a uinavigationcontroller. Please help me.

+6
source share
3 answers

Try

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"yourImage"] forBarMetrics:UIBarMetricsDefault]; 
+14
source

Use this

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self.window makeKeyAndVisible]; [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"yourImage"] forBarMetrics:UIBarMetricsDefault]; return YES; } 
+3
source

code on swift 3

 UINavigationBar.appearance().setBackgroundImage(UIImage(named:"pattern.png"), for: .default) 
0
source

Source: https://habr.com/ru/post/911850/


All Articles