UITabBarItem整体设置

@implementation BSTabBarController

+ (void)load{
    
   UITabBarItem *item =  [UITabBarItem appearanceWhenContainedInInstancesOfClasses:@[self]];
    
        NSMutableDictionary *textAttributes = [NSMutableDictionary dictionary];
        [textAttributes setValue:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName];
        [item setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
        [textAttributes setValue:[UIColor blackColor] forKey:NSForegroundColorAttributeName];
         [item setTitleTextAttributes:textAttributes forState:UIControlStateSelected];
}

一个tabBarController有好几个tabBarItem, 一次性地设置外观很方便。

原文地址:https://www.cnblogs.com/yintingting/p/4540205.html