宽容他人,放过自己。

修改状态栏的颜色-使其变成白色

Posted on By anchoriteFili

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
第一步:在Info.plist中设置UIViewControllerBasedStatusBarAppearance 为NO

752372-20160511111919562-1321220731.png

第二步:在appdelegate中加下一句
UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent;

这样就可以把默认的黑色改为白色。

752372-20160511112042749-54508872.png

UIApplication.shared.isStatusBarHidden = true可进行状态栏的隐藏