2

I currently use UIModalPresenationOverFullScreen to present the next controller and at this moment I want to change the UIStatusBarStyle. The previous controller has got the UIStatusBarStyleDefault but in the current I want to use UIStatusBarStyleLightContent.

Because of the UIModalPresenationOverFullScreen the previous controller is still alive in the background. Which causes the problem that the current will inherit that style.

In the plist file I've set View controller-based status bar appearance to YES and have been trying with some tips like:

[self setNeedsStatusBarAppearanceUpdate];
self.navigationController.navigationBar.barStyle =UIStatusBarStyleLightContent;
- (UIStatusBarStyle)preferredStatusBarStyle { 
      return UIStatusBarStyleLightContent; 
}

Nothings seems to work. Anyone who'r run into the same problem. I still want the previous controller to be alive but change the UIStatusBarstyle.

4

1 回答 1

7

您可以使用

self.modalPresentationCapturesStatusBarAppearance = YES;

在模态控制器中。

从文档中:

modalPresentationCapturesStatusBarAppearance 属性

指定非全屏呈现的视图控制器是否从呈现视图控制器接管状态栏外观的控制。

于 2015-10-12T09:02:20.937 回答