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];

        

    }

  • 相关阅读:
    hdu-5761 Rower Bo(数学)
    hdu-5754 Life Winner Bo(博弈)
    hdu-5753 Permutation Bo(概率期望)
    hdu-5752 Sqrt Bo(水题)
    hdu-5749 Colmerauer(单调栈)
    svn使用教程
    less
    springmvc 孔浩 hibernate code
    springmvc 开涛 生产者/消费者
    springmvc 开涛 拦截器
  • 原文地址:https://www.cnblogs.com/zhibin/p/4156648.html
Copyright © 2011-2022 走看看