統一設置導航欄的皮膚顏色

+ (void)initialize{app

    

    UINavigationBar *bar = [UINavigationBar appearance];ui

//    [self buttonImageFromColor:[UIColor blackColor]]orm

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

    [bar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];io

    

    // 設置uibarbuttonitem統一爲白色table

    UIBarButtonItem *item = [UIBarButtonItem appearance];im

    NSMutableDictionary *attributes = [NSMutableDictionary dictionary];top

    attributes[NSForegroundColorAttributeName] = [UIColor whiteColor];dict

    [item setTitleTextAttributes:attributes forState:UIControlStateNormal];img

    

    // 設置導航欄返回按鈕的顏色

    [bar setTintColor:[UIColor whiteColor]];

    

    // 導航欄設置黑色後,標題設置白色

    NSMutableDictionary *dic = [NSMutableDictionary dictionary];

    dic[NSForegroundColorAttributeName] = [UIColor whiteColor];

    [bar setTitleTextAttributes:dic];

}

相關文章
相關標籤/搜索