Reputation: 23
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
.
Upvotes: 2
Views: 944
Reputation: 71
You may use
self.modalPresentationCapturesStatusBarAppearance = YES;
in the modal controller.
From the documentation:
modalPresentationCapturesStatusBarAppearance Property
Specifies whether a view controller, presented non-fullscreen, takes over control of status bar appearance from the presenting view controller.
Upvotes: 7