0
votes

With the new iOS 13 view controller changes, view controllers are being presented that don't cover the whole screen. They instead leave a black space at the top. However, the system status bar is not changing colour automatically. When I present a modal view controller, the status bar is staying with now-invisible black text (and a green battery which looks super weird in the middle of nowhere).

How do I make the bar behave in the same way as within Apple's apps, where the bar animates to different colour when a modal popup appears?

I've tried setting modalPresentationCapturesStatusBarAppearance to true on my modal controllers, to no luck.

The bar in my presenting view controller is a UINavigationBar, and is not part of a navigation controller. The presenting VC is its delegate, and I've overridden position(for bar: UIBarPositioning) to return .topAttached.

I've tried presenting the modal with .modalPresentationStyle = .formSheet and without setting .modalPresentationStyle at all. Neither worked.

Broken:

broken view controller

The presenting VC:

the presenting view controller

Expected Behaviour:

![expected behaviour, as shown in calendar app

1

1 Answers

0
votes

Two things:

The modal view controllers need to have VC.modalPresentationCapturesStatusBarAppearance = false. This is the default but if, like me, you set it to something else, make sure it's false!

You need to ensure that View controller-based status bar appearance in your info.plist is set to YES. I'd messed around with it in an attempt to make my status bar the right colour but having it set to NO was a problem.