Home Tutorial Iphone Examples Background Image for Navigation Bar

 
 

Share on Google+Share on Google+
Background Image for Navigation Bar
Posted on: April 20, 2010 at 12:00 AM
Advertisement
The tutorial illustrates how to add background image for UINavigationBar.

Background Image for Navigation Bar

The tutorial illustrates how to add background image for UINavigationBar.

To add a background image to UINavigationBar, you need to create a category that extends UINavigationBar. Just find the below given code and add it into your implementation file.

@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed: @"background.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}
@end

After implementing it.. you can call it anywhere within your application and you can see the change on every view. Do not forget to add image into your resources folder.

Just build your application and it must look like as given output...

Download Code

Advertisement

Related Tags for Background Image for Navigation Bar:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 20, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com