zoukankan      html  css  js  c++  java
  • 统一设置导航栏的皮肤颜色

    + (void)initialize{

        

        UINavigationBar *bar = [UINavigationBar appearance];

    //    [self buttonImageFromColor:[UIColor blackColor]]

        UIImage *image = [UIImage imageNamed:@"img_nav_topbar"];

        [bar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];

        

        // 设置uibarbuttonitem统一为白色

        UIBarButtonItem *item = [UIBarButtonItem appearance];

        NSMutableDictionary *attributes = [NSMutableDictionary dictionary];

        attributes[NSForegroundColorAttributeName] = [UIColor whiteColor];

        [item setTitleTextAttributes:attributes forState:UIControlStateNormal];

        

        // 设置导航栏返回按钮的颜色

        [bar setTintColor:[UIColor whiteColor]];

        

        // 导航栏设置黑色后,标题设置白色

        NSMutableDictionary *dic = [NSMutableDictionary dictionary];

        dic[NSForegroundColorAttributeName] = [UIColor whiteColor];

        [bar setTitleTextAttributes:dic];

    }

  • 相关阅读:
    链接收藏:bullet物理引擎不完全指南
    设计模式的六大原则
    链接错误 2038
    玄天宝录
    第二章 期中架构
    第一章 Linux基础
    13 代理与负载均衡基础
    12 LNMP搭建
    11 搭建博客
    10 Nginx模块介绍
  • 原文地址:https://www.cnblogs.com/-boy/p/4456493.html
Copyright © 2011-2022 走看看