自定义标签栏下方的空间

时间:2013-05-16 18:40:14

标签: ios xcode uitabbarcontroller uitabbar

我将自定义标签栏图像添加到xcode中的UITabBar,但图像不会与屏幕底部齐平。

我正在使用

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];

我的图像高49像素(视网膜图形为98像素),它们的工作和加载都很好 - 但是它们下面总共有6像素(12px视网膜)空间。

我已经通过iPhone 4和iPhone 5上的屏幕抓取验证了这一点,并且标签栏下面总是有这个空白的6px空间。

任何人都有任何想法,为什么会这样,或者如何摆脱它,所以我的标签栏图像正好靠在屏幕的底部?

由于

0 个答案:

没有答案