导航栏的背景颜色以及字体大小颜色和大小的设置

来源:互联网 发布:淘宝潮牌旗舰店 编辑:程序博客网 时间:2024/06/05 16:05

   方法一:(自定义视图的方法,一般人也会采用这样的方式)

就是在导航向上添加一个titleView,可以使用一个label,再设置label的背景颜色透明,字体什么的设置就很简单了。(label的创建就不写了)

self.navigationItem.titleView = titleLabel;

    //方法二:导航栏标题字体颜色和大小

    [self.navigationController.navigationBar setTitleTextAttributes:

     

  @{NSFontAttributeName:[UIFont systemFontOfSize:23],

    

    NSForegroundColorAttributeName:[UIColor whiteColor]}];




    //导航栏背景颜色

    self.navigationController.navigationBar.barTintColor = [UIColor blackColor];

0 0