- 修改所有状态栏颜色
UIView *stautsBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
stautsBar.backgroundColor = [UIColor redColor];
- 修改单个页面的状态栏颜色
添加自定义View放在试图上替代状态栏。如果导航栏存在也可放在导航栏上,则frame的origin.y为-20。
UIView *statusBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, IphoneWidth, 20)];
statusBar.backgroundColor = [UIColor redColor];
[self.view addSubview:statusBar];