设置状态栏、导航栏背景颜色,修改导航栏返回按钮颜色

1、设置状态栏为透明黑色:

AppDelegate.h的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions函数里:添加:

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque

// UIStatusBarStyleBlackTranslucent不行


2、设置导航栏背景颜色和返回按钮颜色

[self.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationBar_bk"] forBarMetrics:UIBarMetricsDefault];

[self.navigationBar setBackgroundColor:[UIColor blackColor]]; // 设置导航栏背景颜色

self.navigationBar.tintColor = [UIColor colorWithRed:51.0/255.0 green:143.0/255.0 blue:210.0/255.0 alpha:0.8]; // 其上默认按钮(比如返回按钮)颜色


你可能感兴趣的:(ios)