首页 > 代码库 > UITabBar的appear设置属性 --iOS

UITabBar的appear设置属性 --iOS

 

    //主题设置

    [[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbar-light"]];

    

NSDictionary * dict = @{

                            NSFontAttributeName : [UIFont systemFontOfSize:14],

                            NSForegroundColorAttributeName : [UIColor grayColor]

                            };

//key 定义在NSAttributedString.h

    NSDictionary * selectDict = @{NSForegroundColorAttributeName : [UIColor darkGrayColor]};

    UITabBarItem * item = [UITabBarItem appearance];

    [item setTitleTextAttributes:dict forState:UIControlStateNormal];

    [item setTitleTextAttributes:selectDict forState:UIControlStateSelected];

 

UITabBar的appear设置属性 --iOS