iOSステータスバーの色を手動で変更する



Manually Change Color Ios Status Bar



場合によっては、iOSステータスバーの背景色を変更して、必要な色を設定する必要があります。できるよ

OC:



- (void)setStatusBarBackgroundColor:(UIColor *)color { UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@'statusBarWindow'] valueForKey:@'statusBar'] if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) { statusBar.backgroundColor = color } }

Swfit:

func setStatusBarBackgroundColor(color: UIColor) { guard let statusBar = UIApplication.sharedApplication().valueForKey('statusBarWindow')?.valueForKey('statusBar') as? UIView else { return } statusBar.backgroundColor = color }```