美文网首页
iOS设置状态栏颜色

iOS设置状态栏颜色

作者: caiios | 来源:发表于2018-12-06 10:41 被阅读0次

//czq 设置状态栏颜色

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

    UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];

    if ([statusBarrespondsToSelector:@selector(setBackgroundColor:)]) {

        statusBar.backgroundColor= color;

    }

}

[self setStatusBarBackgroundColor:MainColor];

相关文章