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

2016-08-14  本文已影响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
self.navigationBar.tintColor = [UIColor whiteColor];
![效果前后对比](https://img.haomeiwen.com/i1914107/d07ff85ca9896461.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

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

上一篇 下一篇

猜你喜欢

热点阅读