您的位置:首页 > 移动开发 > IOS开发

IOS 导航条 以及 状态栏颜色 相关设置

2015-12-07 10:20 531 查看

局部导航栏颜色设置

//设置导航条颜色 美团导航栏颜色
self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:78.0/255 green:238.0/255 blue:218.0/255 alpha:1.0];

//设置导航条文字颜色 白色
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};

//设置按钮文字颜色 白色
self.navigationController.navigationBar.setTintColor = [UIColor whiteColor]];


全局导航栏颜色设置

/*在 AppDelegate.m 中*/
//设置导航条颜色 美团导航栏颜色
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:78.0/255 green:238.0/255 blue:218.0/255 alpha:1.0]];

//设置导航条文字颜色 白色
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];

//设置按钮文字颜色 白色
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

//设置导航栏按钮字体大小
[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:15], UITextAttributeFont,nil] forState:UIControlStateNormal];


更改状态栏颜色白色

===============2015.11.22=================

突然发现了在General里面调节StatusBarStyle就可以了,这样还可以解决LaunchScreen.storyboard中状态栏颜色黑色的问题。



==================Old===================

* 首先在info.plist中添加一条UIViewControllerBasedStatusBarAppearance,值为NO

* 再在程序里写下面的语句

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: