修改UINavigationController,UINavigationBar背景颜色,字体颜色




- (void)setNav

{

    UINavigationBar *bar = [UINavigationBar appearance];

    //设置显示的颜色

    bar.barTintColor = [UIColor colorWithRed:62/255.0 green:173/255.0 blue:176/255.0 alpha:1.0];

    //设置字体颜色

    bar.tintColor = [UIColor whiteColor];

    [bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];

//或者用这个都行

//    [bar setTitleTextAttributes:@{UITextAttributeTextColor : [UIColor whiteColor]}];


}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {


//*********

[self setNav];//修改程序中所有的显示的navigationbar的颜色,字体


//********

}


如图


修改UINavigationController,UINavigationBar背景颜色,字体颜色_第1张图片




你可能感兴趣的:(iOS)