首页 > 代码库 > 改变navigationBar的颜色

改变navigationBar的颜色

目前就能改leftBarButtonItem,rightBarButtonItem一样的颜色,

打开plist文件加入 View controller-based status bar appearance,将value改为no,在设置你想改的颜色

self.navigationController.navigationBar.tintColor = [UIColor grayColor];

如果想两边不一样颜色,只能自己写个

UIImageView
_rightView = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 60, 8, 30, 30)]; _rightView.userInteractionEnabled = YES;[self.navigationController.navigationBar  insertSubview:_rightView  atIndex:1];
必须加上这个方法

- (void)viewWillDisappear:(BOOL)animated

{

    [_rightView removeFromSuperview];

}

改变navigationBar的颜色