首页 > 代码库 > IOS 杂笔-13(appearance的巧妙使用)

IOS 杂笔-13(appearance的巧妙使用)

技术分享
NSDictionary * attrs = @{
                             
                             NSFontAttributeName:[UIFont systemFontOfSize:13],
                             NSForegroundColorAttributeName:[UIColor grayColor]
                             
                             };
    
    NSDictionary * selectAttrs = @{
                                   
                                   NSFontAttributeName:[UIFont systemFontOfSize:12],
                                   NSForegroundColorAttributeName:[UIColor darkGrayColor]
                                   
                                   };
    
    UITabBarItem * item = [UITabBarItem appearance];
    [item setTitleTextAttributes:attrs forState:UIControlStateNormal];
    [item setTitleTextAttributes:selectAttrs forState:UIControlStateSelected];
技术分享

IOS 杂笔-13(appearance的巧妙使用)