1.设置属性statusBar的样式
@property (assign, nonatomic) UIStatusBarStyle statusBarStyle;
2.重写系统的属性方法
- (UIStatusBarStyle)preferredStatusBarStyle
{
return self.statusBarStyle;
}
3.在需要更改颜色的位置对属性statusBarStyle赋值即可,切记要调用[self setNeedsStatusBarAppearanceUpdate]来让控制器刷新状态栏
self.statusBarStyle = UIStatusBarStyleLightContent;
[self setNeedsStatusBarAppearanceUpdate];
网友评论