美文网首页
修改 状态栏颜色

修改 状态栏颜色

作者: 爱喝农药de清凉 | 来源:发表于2017-07-11 11:44 被阅读12次

pragma mark - 页面 出现&消失

  • (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];

    [self setStatusBarBackgroundColor:JKColor(88, 79, 95)];

}

  • (void)viewDidDisappear:(BOOL)animated{
    [super viewDidDisappear:animated];

[self setStatusBarBackgroundColor:[UIColor clearColor]];

}

//设置状态栏颜色

  • (void)setStatusBarBackgroundColor:(UIColor *)color {

    UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
    NSLog(@"statusBar.backgroundColor--->%@",statusBar.backgroundColor);
    if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
    statusBar.backgroundColor = color;
    }
    }

相关文章

网友评论

      本文标题:修改 状态栏颜色

      本文链接:https://www.haomeiwen.com/subject/ponphxtx.html