导航栏标题颜色 自定义
方法一:修改导航栏标题颜色大小 (不推荐使用 这样会所有自控制器的导航栏颜色都会改变)
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:19],
NSForegroundColorAttributeName:[UIColor redColor]}];
方法二:自定义一个label (这样只是你需要改变导航栏标题颜色的自控制器改变)UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
titleLabel.font = [UIFont boldSystemFontOfSize:20];
titleLabel.textColor = [UIColor whiteColor];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.text = @"全部分类";
self.navigationItem.titleView = titleLabel;
导航栏自定义按钮 颜色改变 (多种方法都可以改变此处不一一例举了但要想不改变其他自控制器按钮颜色的用此法)
UIButton*btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn. frame=CGRectMake(18*ScreenZoomScaleSix, 5, 23*ScreenZoomScaleSix, 23*ScreenZoomScaleSix);
[btn setBackgroundImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(goBackAction)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem*back=[[UIBarButtonItem alloc]initWithCustomView:btn];
self.navigationItem.leftBarButtonItem = back;