UITabBarController的一些事

2016-06-04  本文已影响49人  Mr_董

设置tabbar选中颜色

    //UITabBar的选中颜色的设置
    [UITabBar appearance].tintColor = [UIColor purpleColor];

设置文字颜色

 NSDictionary * attritext = @{NSForegroundColorAttributeName:[UIColor colorWithRed:186/255.0 green:136.0/255.0 blue:42.0/255.0 alpha:1]};
   
 [[UITabBarItem appearance] setTitleTextAttributes:attritext forState:UIControlStateSelected];
   self.tabBarItem.title = @"袭击以来";
   self.tabBarItem.badgeValue = @"10";
   self.tabBarItem.image = [UIImage imageNamed:@"icon_mine2_red2"];
   self.navigationController.tabBarItem.title = @"袭击以来";
   self.navigationController.tabBarItem.badgeValue = @"10";
   self.navigationController.tabBarItem.image = [UIImage imageNamed:@"icon_mine2_red2"];
    UIViewController * vc = self.childViewControllers[3];
    vc.tabBarItem.badgeValue = @"8";
    vc.tabBarItem.title = @"新名字";
/*
 Default is YES.
 You may force an opaque background by setting the property to NO.
 If the tab bar has a custom background image, the default is inferred from the alpha
 values of the image—YES if it has any pixel with alpha < 1.0
 If you send setTranslucent:YES to a tab bar with an opaque custom background image
 the tab bar will apply a system opacity less than 1.0 to the image.
 If you send setTranslucent:NO to a tab bar with a translucent custom background image
 the tab bar will provide an opaque background for the image using the bar's barTintColor if defined, or black
 for UIBarStyleBlack or white for UIBarStyleDefault if barTintColor is nil.
 */
self.tabBarController.tabBar.translucent = YES;
上一篇 下一篇

猜你喜欢

热点阅读