美文网首页
简单区分下设置导航栏各部分颜色的方法

简单区分下设置导航栏各部分颜色的方法

作者: 马铃薯蜀黍 | 来源:发表于2016-08-14 11:26 被阅读21次
  • 设置背景图片的方法
//第一种方法
[self.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav_bac"]forBarMetrics:UIBarMetricsDefault] ;

//第二种方法
self.navigationBar.barTintColor = [UIColor redColor];
效果就是通红的这张图片沾满了的背景.png
nav_bac.png
  • 设置标题文字颜色的方法

NSDictionary * dic = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
    [self.navigationBar setTitleTextAttributes:dic];
QQ20160814-0.png
  • 将返回的barbuttonItem 以及 rightBarButtonItem 改变颜色的方法 :
self.navigationBar.tintColor = [UIColor whiteColor];
![效果前后对比](https://img.haomeiwen.com/i1914107/d07ff85ca9896461.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

个人感觉基本上这样应该就够用了,希望能够帮到你~

相关文章

网友评论

      本文标题:简单区分下设置导航栏各部分颜色的方法

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