Background Image for UINavigationController - ParkinT/RubyMotion_Life GitHub Wiki

Background Image in Navigation Controller

{Thanks to Ruben}

Using the iOS5 appearance APIs to set the whole image, do this:

image = UIImage.imageNamed('navbar-portrait.png') 
self.navigationBar.appearance.setBackgroundImage(image, forBarMetrics:UIBarMetricsDefault) 

and again for landscape

image = UIImage.imageNamed('navbar-landscape.png') 
self.navigationBar.appearance.setBackgroundImage(image, forBarMetrics:UIBarMetricsLandscapePhone) 

If you have a repetable pattern image, you can easly use it to fill the navigation bar, by creating a strechable image:

image = UIImage.imageNamed('navbar.png').resizaableImageWithCapInsets(UIEdgeInsetsMake(top, left, bottom, right)) 

and then use it like above on the navigationBar appearance proxy.