Skip to content

Instantly share code, notes, and snippets.

@doronkatz
Created April 22, 2011 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doronkatz/935796 to your computer and use it in GitHub Desktop.
Save doronkatz/935796 to your computer and use it in GitHub Desktop.
Quick way to modify look of UITabBarController
#pragma mark UITabBarController customisation to add background image
//In your appDelegate, just use categories to add functionality to UITabBarController
//overloading viewDidLoad. No need to subclass
@implementation UITabBarController (UITabBarControllerCategory)
- (void)viewDidLoad {
[super viewDidLoad];
CGRect frame = CGRectMake(0.0, 0.0, self.view.bounds.size.width, 48);
UIImageView *imageView = [[UIImageView alloc] initWithFrame:frame];
UIImage *img = [UIImage imageNamed: @"uinavbar.png"];
[imageView setImage:img];
[imageView setAlpha:0.5];
[[self tabBar] addSubview:imageView];
[imageView release];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment