Reputation: 2034
The main view of my app is a scrollable UICollectionView
embedded in a UITabBarController
. I'm not using a navigation bar and when the user scrolls he sees the cells behind the status bar, because the status bar has no background.
I've used UIApplication.shared.statusBarView?.backgroundColor = .white
in my AppDelegate to apply a background and to make the status bar look like desired.
This works fine, but doesn't look nice when you're presenting a UIAlertController
.
The white status bar stays above the dimmed background.
Is there a better way to apply a background to the status bar or a way to keep it behind the UIAlertController
background?
Upvotes: 0
Views: 305
Reputation: 912
You can try to use a UIView
with a background color at the top of your presenting UIView
.
Height of status bar can come from UIApplication.shared.statusBarFrame
. And update your view size when receiving UIApplication.didChangeStatusBarFrameNotification
.
Upvotes: 1