zoukankan      html  css  js  c++  java
  • IOS 自定义全局navigaitonbar 属性样式

    @implementation ZBMainViewController

    - (void)viewDidLoad {

        [super viewDidLoad];

      

    }

    +(void)initialize

    {

        [self setupBarButtonItemTheme];

        [self setupNavigationBarTheme];

    }

    +(void)setupBarButtonItemTheme{

        UIBarButtonItem *appearance=[UIBarButtonItem appearance];

        

        NSMutableDictionary *dict=[NSMutableDictionary dictionary];

        dict[NSFontAttributeName]=[UIFont systemFontOfSize:15];

       dict[NSForegroundColorAttributeName]=[UIColor greenColor];

        NSShadow *shadow=[[NSShadow alloc] init];

        shadow.shadowColor=[UIColor blueColor];

        shadow.shadowOffset=CGSizeMake(1, 1);

        

        

        dict[NSShadowAttributeName]=shadow;

        

        [appearance setTitleTextAttributes:dict forState:UIControlStateNormal];

    }

    +(void)setupNavigationBarTheme{

        

        

        UINavigationBar *apperarance=[UINavigationBar appearance];

        [apperarance setBackgroundImage:[UIImage imageNamed:@"bar_background"] forBarMetrics:UIBarMetricsDefault];

        

        NSMutableDictionary *dict=[NSMutableDictionary dictionary];

        dict[NSFontAttributeName]=[UIFont systemFontOfSize:18];

        dict[NSForegroundColorAttributeName]=[UIColor redColor];

       NSShadow *shadow= [[NSShadow alloc]init];

        shadow.shadowColor=[UIColor grayColor];

        shadow.shadowOffset=CGSizeMake(1, 1);

        

        dict[NSShadowAttributeName]=shadow;

        

        [apperarance setTitleTextAttributes:dict];

        

    }

  • 相关阅读:
    pytest之fixture的详细使用
    pytest之自定义标记mark
    解决pytest.mark自定义标签导致的warning
    pytest之参数化parametrize的使用
    Jenkins上allure报告清空上一次运行记录
    Jenkins配置从节点并生成allure测试报告
    《编程珠玑》笔记:数组循环左移
    精确覆盖 DLX
    海量数据的插入和查找 bloom filter
    ORACLE数据库的一些限制
  • 原文地址:https://www.cnblogs.com/zhibin/p/4156648.html
Copyright © 2011-2022 走看看