1 #import "UINavigationBar+Background.h"
2
3 @implementation UINavigationBar (UINavigationBarCategory)
4
5 - (void) setBackgroundImage:(UIImage*)image withTag:(NSInteger)bgTag{
6 if (image == NULL) {
7 return;
8 }
9
10 UIImageView *aTabBarBackground = [[UIImageView alloc]initWithImage:image];
11 aTabBarBackground.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
12 aTabBarBackground.tag = bgTag;
13 [self addSubview:aTabBarBackground];
14 [self sendSubviewToBack:aTabBarBackground];
15 [aTabBarBackground release];
16 }
17
18 /* input: The tag you chose to identify the view */
19 - (void) resetBackground:(NSInteger)bgTag {
20 [self sendSubviewToBack:[self viewWithTag:bgTag]];
21 }
22
23 @end