Reputation: 170
When in dark mode and presenting a view controller modally (or popovers), even if the view's background color is say black, it gets overridden to the elevated system background color (a dark grey when in dark mode, white when in light mode).
// Still shows as dark grey when presented modally or in popover
self.view.backgroundColor = .black
Is it possible to override this behavior and let the original background color be shown (black instead of the elevated grey in dark mode)?
Upvotes: 0
Views: 1204
Reputation: 170
Solved! In order to override this behavior, you simply need to set definesPresentationContext
to true
on the view controller being presented.
modalViewController.definesPresentationContext = true
Upvotes: 2