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

ios 设置状态栏背景颜色

2014-10-10 16:25 393 查看
第一种方法:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;

self.navigationController.navigationBar.tintColor = [UIColor blackColor];

if (is_ios_7_Later) {

self.view.window.frame = CGRectMake(0, 20,
self.view.window.frame.size.width, self.view.window.frame.size.height - 20);
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
}
第二种方法(这方法比较简单):


UIView *statusBarView=[[UIView
alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];

statusBarView.backgroundColor=[UIColor
blackColor];
[self.view
addSubview:statusBarView];

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