1.设置导航栏中间文字的文字颜色和文字大小
方法一:系统方法
self.title = @"下载微课";//在有navigationController的控制器中,作用与self.navigationItem.title = @"下载微课";相同
[self.navigationController.navigationBar setTitleTextAttributes:
@{NSFontAttributeName:[UIFont systemFontOfSize:18],
NSForegroundColorAttributeName:[UIColor whiteColor]}];//系统方法
方法二:自定义控件
self.navigationItem.title = @"下载微课";
//修改导航栏
UILabel *titleLable = [[UILabel alloc]initWithFrame:CGRectMake(0,0,100,30)];
titleLable.text = @"下载微课";
titleLable.textColor = [UIColor whiteColor];
titleLable.font = [UIFont systemFontOfSize:18];
self.navigationItem.titleView = titleLable;
效果图:
2.设置返回键的颜色和样式