改变UITabBarItem 字体颜色

self.tabBar.tintColor = [UIColor colorWithHexString:BLUE_GREEN_COLOR];
       
UITabBarController *tabBarController = (UITabBarController*)self;
    
UITabBar *tabBar = tabBarController.tabBar;


    
UITabBarItem *trainEnquiryItem  = [tabBar.items objectAtIndex:0];
    
    
[trainEnquiryItem setTitle:@"查询"];
    
[trainEnquiryItem setImage:[UIImage imageNamed:@"tet"]];
    
[trainEnquiryItem setSelectedImage:[UIImage imageNamed:@"tet_hover"]];
  

改变UITabBarItem 字体颜色 
  
      [[UITabBarItem appearancesetTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColornilforState:UIControlStateNormal];
    [[UITabBarItem appearancesetTitleTextAttributes:
            [NSDictionarydictionaryWithObjectsAndKeys:[UIColorcolorWithHexString:"#00C8D3"],UITextAttributeTextColornil]forState:UIControlStateSelected];

你可能感兴趣的:(改变UITabBarItem 字体颜色)