Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to completely colorize UIPopoverPresentationController background color?

I'm working with a Day and Night Mode for an app. The problem is, when just setting the background color of a view AND THEN using it as "presenting as popover" there are little white artifacts (see the picture)

Is there an easy way to fix this? Do I may have to write my own UIView?

enter image description here

like image 806
Mario Avatar asked Aug 09 '15 15:08

Mario


2 Answers

You can set the UIPopoverPresentationController's backgroundColor. If that isn't sufficient, you will have to customize your popover's UIPopoverBackgroundView. This gives you control of the entire popover background, including the little triangle.

like image 159
matt Avatar answered Nov 04 '22 04:11

matt


Here is some code to supplement matt's answer.

popoverController.popoverPresentationController?.backgroundColor = myColor

or

self.navigationController?.popoverPresentationController?.backgroundColor = myColor
like image 22
Suragch Avatar answered Nov 04 '22 02:11

Suragch