首页 > 移动平台 > 详细

IOS 自定义全局navigaitonbar 属性样式

时间:2014-12-11 01:31:12      阅读:303      评论:0      收藏:0      [点我收藏+]

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

    

}

 

IOS 自定义全局navigaitonbar 属性样式

原文:http://www.cnblogs.com/zhibin/p/4156648.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!