IOS改变导航栏标题颜色

//直接用系统的
//设置导航栏的标题
    self.navigationItem.title=@"选择奖励对象";
    //设置字体大小和颜色
    [self.navigationController.navigationBar setTitleTextAttributes:
  @{NSFontAttributeName:[UIFont systemFontOfSize:18],
    NSForegroundColorAttributeName:[UIColor whiteColor]}];

自己定制的

//自定义标题视图
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
titleLabel.backgroundColor = [UIColor grayColor];
titleLabel.font = [UIFont boldSystemFontOfSize:20];
titleLabel.textColor = [UIColor greenColor];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.text = @"标题";
self.navigationItem.titleView = titleLabel;


你可能感兴趣的:(ios,导航)