iPhone TabBar Custom Background Image
I have spent a bit of time implementing a background image behind my TabBar in an iPhone App. I used a combination of internet tutorials and so I have posted my own variant.
Step 1:
Create a new class named CustomUITabBarController.
Step 2:
Insert the following code
CustomUITabBarController.h
// CustomUITabBarController.h
#import <UIKit/UIKit.h>
@interface CustomUITabBarController: UITabBarController {
IBOutlet UITabBar *tabBar1;
}
@property(nonatomic, retain) UITabBar *tabBar1;
@end
CustomUITabBarController.m
// CustomUITabBarController.m
#import "CustomUITabBarController.h"
@implementation CustomUITabBarController
@synthesize tabBar1;
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NavBar.png"]];
img.frame = CGRectOffset(img.frame, 0, 1);
[tabBar1 insertSubview:img atIndex:0];
[img release];
}
@end
Step 3:
In Interface Builder, link up the newly created outlet ‘tabbar1′ to the pre-existing tab bar.
Step 4:
Add a background file NavBar.png to your project resources.
And thats it!
Downloads:
References:
UITabBar Backgrounds
Here are some TabBars I have quickly put together. These are free for use and adaption.




