iOS 切换状态栏StatusBar

1.先写 [self setNeedsStatusBarAppearanceUpdate];
2.重写 [self preferredStatusBarStyle];

  • (UIStatusBarStyle)preferredStatusBarStyle {
    if (self.view.backgroundColor == kWhiteColor) {
    return UIStatusBarStyleDefault;
    }
    return UIStatusBarStyleLightContent;
    }
    3.即可控制切换

你可能感兴趣的:(iOS 切换状态栏StatusBar)