I am adding images in tabbar. The iamge size is 49px. Adding is working fine. But the layout having an issue. all tabbar item images' top part is out of tabbar's frame, and there is ablank space down.
How to fix this ?
This is how I create Tabbar
localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
myhomeVC = [[EventListView alloc] initWithNibName:@"EventListView_iPhone" bundle:nil];
homeNavBar=[[UINavigationController alloc]initWithRootViewController:myhomeVC];
homeNavBar.tabBarItem.title=nil;
groupVC = [[ItineryView alloc] initWithNibName:@"ItineryView_iPhone" bundle:nil];
groupNavBar=[[UINavigationController alloc]initWithRootViewController:groupVC];
//groupNavBar.tabBarItem.title=@"";
uploadVC = [[FilesView alloc] initWithNibName:@"FilesView_iPhone" bundle:nil];
uploadNavBar=[[UINavigationController alloc]initWithRootViewController:uploadVC];
//uploadNavBar.tabBarItem.title=@"";
searchVC = [[PhotosView alloc] initWithNibName:@"PhotosView_iPhone" bundle:nil];
searchNavBar=[[UINavigationController alloc]initWithRootViewController:searchVC];
//searchNavBar.tabBarItem.title=@"";
nearbyVC = [[AttendeesView alloc] initWithNibName:@"AttendeesView_iPhone" bundle:nil];
nearbyNavBar=[[UINavigationController alloc]initWithRootViewController:nearbyVC];
//nearbyNavBar.tabBarItem.title=@"";
[localViewControllersArray addObject:homeNavBar];
[localViewControllersArray addObject:groupNavBar];
[localViewControllersArray addObject:uploadNavBar];
[localViewControllersArray addObject:searchNavBar];
[localViewControllersArray addObject:nearbyNavBar];
appDelegate.tabBarController.viewControllers = localViewControllersArray;
[self.parentViewController.view setHidden:YES];
appDelegate.window.rootViewController = appDelegate.tabBarController;
and setting tabbar item like this -
-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"navHomeHL.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"navHome.png"]];
} }
return self;
}