Search code examples
iosuitabbarcontrolleruitabbaruitabbaritemios7.1

Strange lines in UITabBarController


I am experiencing a strange white line between tabs in UITabBarController. I am using following code

    [[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 The code was working fine before iOS7.1 but has isues in iOS 7.1. Any suggestions?


Solution

  • Got it fixed, not a good one but serves the purpose. increased the image of tabbar towards left by 1 pixel.

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

    Any other answers are welcome.