I have two view controllers - the first has a UIStatusBarStyleDefault
, the second has a UIStatusBarStyleLightContent
.
VC1 is presenting VC2 as a modal form sheet. So when presenting in regular trait collection, VC2 is presented as UIModalPresentationFormSheet
and VC1 sets the status bar to Default.
But in compact trait collection, VC2 is fullscreen and sets the status bar style to Light Content.
The problem is when switching between regular to compact (full screen to form sheet) the status bar is not updating.
Trying - [self setNeedsStatusBarAppearanceUpdate]; after trait collection change did not solve the issue.
Any help will be much appreciated!
The icons in the status bar at the top of the screen provide information about iPad. Note: If you turn on a Focus, its icon appears in the status bar. Wi-Fi. iPad has a Wi-Fi internet connection.
A status bar appears along the upper edge of the screen and displays information about the device's current state, like the time, cellular carrier, and battery level.
Open an app. Slide one finger up from the bottom edge of the screen until the Dock appears, then release. Touch and hold a second app in the Dock, then immediately drag it up out of the Dock. If you drag the app to the left or right edge of the screen, it appears in Split View with the current app.
// This controls whether this view controller takes over control of the status bar's appearance when presented non-full screen on another view controller. Defaults to NO.
@available(iOS 7.0, *)
public var modalPresentationCapturesStatusBarAppearance: Bool
Usage:
navigationController.modalPresentationStyle = .FormSheet
navigationController.modalPresentationCapturesStatusBarAppearance = true
Once that's set the root view controller of that navigation controller can override the preferredStatusBarStyle()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With