首页 > 其他 > 详细

统一设置导航栏的皮肤颜色

时间:2015-04-25 21:05:44      阅读:258      评论:0      收藏:0      [点我收藏+]

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

}

 

统一设置导航栏的皮肤颜色

原文:http://www.cnblogs.com/-boy/p/4456493.html

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