0

I am adding custom tab bar images to a UITabBar in xcode, but the images dont sit flush against the bottom of the screen.

I am using

UIImage *selectedImage0 = [UIImage imageNamed:@"tabbar_image1_active.png"];
UIImage *unselectedImage0 = [UIImage imageNamed:@"tabbar_image1_default.png"];

UIImage *selectedImage1 = [UIImage imageNamed:@"tabbar_image2_active.png"];
UIImage *unselectedImage1 = [UIImage imageNamed:@"tabbar_image2_default.png"];

UIImage *selectedImage2 = [UIImage imageNamed:@"tabbar_image3_active.png"];
UIImage *unselectedImage2 = [UIImage imageNamed:@"tabbar_image3_default.png"];

UIImage *selectedImage3 = [UIImage imageNamed:@"tabbar_image4_active.png"];
UIImage *unselectedImage3 = [UIImage imageNamed:@"tabbar_image4_default.png"];

UIImage *selectedImage4 = [UIImage imageNamed:@"tabbar_image5_active.png"];
UIImage *unselectedImage4 = [UIImage imageNamed:@"tabbar_image5_default.png"];

UITabBar *tabBar = self.tabBarController.tabBar;
UITabBarItem *item0 = [tabBar.items objectAtIndex:0];
UITabBarItem *item1 = [tabBar.items objectAtIndex:1];
UITabBarItem *item2 = [tabBar.items objectAtIndex:2];
UITabBarItem *item3 = [tabBar.items objectAtIndex:3];
UITabBarItem *item4 = [tabBar.items objectAtIndex:4];

[item0 setFinishedSelectedImage:selectedImage0 withFinishedUnselectedImage:unselectedImage0];
[item1 setFinishedSelectedImage:selectedImage1 withFinishedUnselectedImage:unselectedImage1];
[item2 setFinishedSelectedImage:selectedImage2 withFinishedUnselectedImage:unselectedImage2];
[item3 setFinishedSelectedImage:selectedImage3 withFinishedUnselectedImage:unselectedImage3];
[item4 setFinishedSelectedImage:selectedImage4 withFinishedUnselectedImage:unselectedImage4];

My images are 49px high (98px for the retina graphics), and they work and load fine - but there is a 6px (12px retina) space underneath them at all times.

I have verified this with screen grabs, on both an iPhone 4 and an iPhone 5, and there is always this blank 6px space underneath the tab bar.

Anyone got any ideas why this is, or how to get rid of it, so my tab bar images sit right against the bottom of the screen?

Thanks

R2D2
  • 2,620
  • 4
  • 24
  • 46

0 Answers0