Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adrienbrault/1015698 to your computer and use it in GitHub Desktop.
Save adrienbrault/1015698 to your computer and use it in GitHub Desktop.
UINavigationController *navCon = ...;
UIImage *background = [UIImage imageNamed:@"navigationBar.png"];
UIImageView *img = [[UIImageView alloc] initWithImage:background];
[navCon.navigationBar insertSubview:img
atIndex:-1];
[img release];
@interface UINavigationBar (CustomBackground)
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
@end
@implementation UINavigationBar (CustomBackground)
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index
{
[super insertSubview:view atIndex:index+1];
}
@end
@interface UINavigationBar (CustomBackground)
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
@end
@implementation UINavigationBar (CustomBackground)
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index
{
[super insertSubview:view atIndex:index+1];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment