Chahal
Chahal

Reputation: 1005

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?

Upvotes: 1

Views: 196

Answers (1)

Chahal
Chahal

Reputation: 1005

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.

Upvotes: 1

Related Questions