2012-02-07 69 views

回答

0

的selectionIndicatorImage只需设置一个

- (void)tabBar:(UITabBar *)theTabBar didSelectItem:(UITabBarItem *)item{ 
    NSUInteger indexOfTab = [[theTabBar items] indexOfObject:item]; 
    [item setFinishedSelectedImage:[UIImage imageNamed: 
            [NSString stringWithFormat:@"%u_btnH.png",indexOfTab]] 
     withFinishedUnselectedImage:[UIImage imageNamed: 
            [NSString stringWithFormat:@"%u_btn.png",indexOfTab]] 
            ]; 
    } 

我的自定义图像TabBarItem是0_btn.png正常和0_btnH.png空图像:
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage alloc]];