iOS Setting Background Color Method for Status Bar

  • 2021-12-19 07:04:00
  • OfStack

Set the background color of the status bar


- (void)setStatusBarBackgroundColor:(UIColor *)color

{

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

  if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {

    statusBar.backgroundColor = color;

  }

}

Related articles: