How to hide the UITabBar selection indicator for ios 4.3 not for 5+?

ios, ipad, iphone

Solution

Try this code:

// iOS 5.0+
[self.tabBar setSelectionIndicatorImage:[[[UIImage alloc] init]autorelease]];


// for earlier versions

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
    [self customizeTabBar];
}

- (void)customizeTabBar {
    NSString *imageName = [NSString stringWithFormat:@"tabBackground%i.png", tabBarCtrl.selectedIndex + 1];

    for(UIView *view in tabBarCtrl.tabBar.subviews) {  
         if([view isKindOfClass:[UIImageView class]]) {  
              [view removeFromSuperview];  
         }  
    }  
    UIImageView *background = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]] autorelease];
    [tabBarCtrl.tabBar insertSubview:background atIndex:0]; 
    [tabBarCtrl.tabBar bringSubviewToFront:background];
    //if needed, here must be adding UILabels with titles, I didn't need it.
} 

Hope it helps! :)

Problem

How to hide the UITabBar selection indicator for ios 4.3 not for 5+ I need to hide the selection indicator of the UITabBar controler in the ios 4.3.

Original source