设置全局导航栏的title颜色和字体

来源:互联网 发布:淘宝联盟怎么查看pid 编辑:程序博客网 时间:2024/05/19 09:14

UINavigationBar *navBar=  [UINavigationBarappearance];

    //设置全局导航栏的背景图片

    [navBar setBackgroundImage:[UIImageimageNamed:@"NavBar64"]forBarMetrics:UIBarMetricsDefault];


    //设置全局导航栏的title颜色和字体

    NSMutableDictionary *arrt = [NSMutableDictionarydictionary];

    arrt[NSForegroundColorAttributeName]=[UIColorwhiteColor];

    arrt[NSFontAttributeName] =[UIFontsystemFontOfSize:18];

    [navBar setTitleTextAttributes:arrt];


iOS7.0以上 需要使用 NSFontAttributeName、NSForegroundColorAttributeName


'UITextAttributeTextColor' is deprecated: first deprecated in iOS 7.0 - UseNSForegroundColorAttributeName

'UITextAttributeFont' is deprecated: first deprecated in iOS 7.0 - UseNSFontAttributeName


0 0
原创粉丝点击