天天看点

iOS-UINavigationBar【颜色设置】

UINavigationBar的一些颜色设置,以前老是忘,这次记住了

- (void)setNavigationBar{
    ///NavigationBar backgroundcolor【背景色】
    [[UINavigationBar appearance] setBarTintColor:Wonderful_GreenColor9];
    ///left、right-item color【左右item的颜色】
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    ///title颜色 Attributes 可以包含字体颜色和大小以及字体样式【中间Title字体】
    [UINavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName :[UIColor whiteColor]};
    
    ///navigation背景图
//    [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
//    [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
//    [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"topbg"] forBarMetrics:UIBarMetricsDefault];
//    [UINavigationBar appearance].translucent = NO;
}