美文网首页
iOS UINavigationController修改导航栏

iOS UINavigationController修改导航栏

作者: 景彧 | 来源:发表于2017-03-16 14:13 被阅读392次

// 方法一

// 导航栏背景颜色
[self.navigationController.navigationBar setBarTintColor:[CommomModule sharedInstance].navigationBarColor];
    
// 导航栏标题字体颜色
[self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:19], NSForegroundColorAttributeName:[CommomModule sharedInstance].navigationBarTextColor}];
    
// 导航栏左右按钮字体颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

// 方法二

UINavigationBar *bar = [UINavigationBar appearance];
// 设置导航栏背景颜色
bar.barTintColor = [UIColor redColor];
// 设置字体颜色
bar.tintColor = [UIColor whiteColor];
[bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];

相关文章

网友评论

      本文标题: iOS UINavigationController修改导航栏

      本文链接:https://www.haomeiwen.com/subject/quqjnttx.html