UITabBarController中的奇怪行

时间:2014-03-20 10:18:21

标签: ios uitabbarcontroller uitabbar uitabbaritem ios7.1

我在UITabBarController中的选项卡之间遇到奇怪的白线。我正在使用以下代码

    [[tabBarControllerObject.tabBarController.tabBar.items objectAtIndex:0] setFinishedSelectedImage:[UIImage imageNamed:@"ios_home_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"ios_home.png"]];
    [[tabBarControllerObject.tabBarController.tabBar.items objectAtIndex:1] setFinishedSelectedImage:[UIImage imageNamed:@"ios_foodItems_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"ios_foodItems.png"]];
    [[tabBarControllerObject.tabBarController.tabBar.items objectAtIndex:2] setFinishedSelectedImage:[UIImage imageNamed:@"ios_advantagesOfFood_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"ios_advantagesOfFood.png"]];
    [[tabBarControllerObject.tabBarController.tabBar.items objectAtIndex:3] setFinishedSelectedImage:[UIImage imageNamed:@"ios_questions_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"ios_questions.png"]];
    [[tabBarControllerObject.tabBarController.tabBar.items objectAtIndex:4] setFinishedSelectedImage:[UIImage imageNamed:@"ios_help_selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"ios_help.png"]];

enter image description here 代码在iOS7.1之前运行良好,但在iOS 7.1中有代码。有什么建议吗?

1 个答案:

答案 0 :(得分:1)

修复它,不是一个好的但是有目的的。将tabbar的图像向左增加1个像素。

        UITabBarItem * tb3 = [personalisedPageTabBarController.tabBar.items objectAtIndex:2];
        tb3.imageInsets = UIEdgeInsetsMake(0, -1, 0, 0);
        UITabBarItem * tb5 = [personalisedPageTabBarController.tabBar.items objectAtIndex:4];
        tb5.imageInsets = UIEdgeInsetsMake(0, -1, 0, 0);

欢迎任何其他答案。