2012-02-07 70 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]];