设置自定义导航条/TabBar及字体颜色

来源:互联网 发布:sweetalk好用吗 知乎 编辑:程序博客网 时间:2024/05/22 08:09

/** 这里用到个三方,转换color的进制*/

//三方 FlatUIKit

    //设置导航条

    //bar的背景颜色

    [[UINavigationBarappearance] setBarTintColor:[UIColorcolorFromHexCode:@"eb5352"]];

    //文本颜色

    [[UINavigationBarappearance] setTintColor:[UIColorwhiteColor]];

    [[UINavigationBarappearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColorwhiteColor],NSFontAttributeName:[UIFontsystemFontOfSize:18]}];



    //tabBarItem全局设定

    //图片选中的原始样式

    self.tabBarItem.selectedImage = [self.tabBarItem.selectedImageimageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

    //选中文本的颜色

    [[UITabBarItemappearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColorcolorFromHexCode:@"eb5352"]} forState:UIControlStateSelected];



1 0