Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preferred status bar style on iPad multitasking - split screen

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.

Full Split Screen

Trying - [self setNeedsStatusBarAppearanceUpdate]; after trait collection change did not solve the issue.

Any help will be much appreciated!

like image 880
Oren Avatar asked Nov 16 '15 13:11

Oren


People also ask

What is the status bar on iPad?

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.

What is the iOS status bar?

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.

How do you use split view on iPad?

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.


1 Answers

// 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()

like image 104
Blair Avatar answered Oct 13 '22 01:10

Blair