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

来源:互联网 发布:飞行燃料走淘宝 编辑:程序博客网 时间:2024/05/16 10:32

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.0blue:210.0/255.0 alpha:0.8]; // 其上默认按钮(比如返回按钮)颜色

0 0