I'm currently implementing a custom tab bar in the app I'm building and I'm having a bit of trouble. I still see a white line on the left hand side when this tab is selected and also on the right when the right tab is selected. The other tabs don't seem quite right either. I'm using iPhone 4 simulator for this.
The menu image is 640x108px (using @2x filename on this one) The icons are 64x50 The selector background is 122x100 (using @2x filename on this one)
As well as this I also would like to change the selector image when the middle tab is highlighted. Is that possible? I've had a dig around here and can't seem to find a solution that works.
I'm implementing my tab bar controller in the AppDelegate.m as follows:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
// Override point for customization after application launch.
//create new tab bar appearance
UITabBar *tabBar = [UITabBar appearance];
//set background image
[tabBar setBackgroundImage:[UIImage imageNamed:@"menu.png"]];
//create a colour and apply it as tint colour when items aren't selected.
UIColor *color=[UIColor colorWithRed:64.0/255.0 green:147.0/255.0 blue:52.0/255.0 alpha:255.0];
UIColor *colorSelected=[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
[tabBar setTintColor:color];
[tabBar setSelectedImageTintColor:colorSelected];
int numberOfTabs = 5;
[tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"selected.png"]];
return YES;
}
Edit:
See the image below for more details
(source: stephenbiggerstaff.net)