改变状态栏的背景色和文字的颜色

如果你想改变状态栏的背景色,你可以试试下边的方法:

    UIApplication *app = [UIApplication sharedApplication];
    id statusBar = [app valueForKey:@"_statusBar"];
    UIView *statusBarV = [statusBar valueForKey:@"_backgroundView"];
    statusBarV.backgroundColor = [UIColor blueColor];

如果你修改状态栏的文字颜色,可以试试

- (UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}

效果如下图所示

 

posted on 2016-11-15 14:33  ITCoderW  阅读(464)  评论(0编辑  收藏  举报

导航