如何完全着色 UIPopoverPresentationController 背景色?
How to completely colorize UIPopoverPresentationController background color?
我正在为一个应用程序使用昼夜模式。
问题是,当仅设置视图的背景颜色然后将其用作 "presenting as popover" 时,几乎没有白色伪影(参见图片)
有没有简单的方法可以解决这个问题?
我可能必须编写自己的 UIView 吗?
您可以设置UIPopoverPresentationController的backgroundColor
。如果这还不够,您将必须自定义弹出窗口的 UIPopoverBackgroundView。这使您可以控制整个弹出窗口背景,包括小三角形。
这里有一些代码来补充马特的回答。
popoverController.popoverPresentationController?.backgroundColor = myColor
或
self.navigationController?.popoverPresentationController?.backgroundColor = myColor
我正在为一个应用程序使用昼夜模式。 问题是,当仅设置视图的背景颜色然后将其用作 "presenting as popover" 时,几乎没有白色伪影(参见图片)
有没有简单的方法可以解决这个问题? 我可能必须编写自己的 UIView 吗?
您可以设置UIPopoverPresentationController的backgroundColor
。如果这还不够,您将必须自定义弹出窗口的 UIPopoverBackgroundView。这使您可以控制整个弹出窗口背景,包括小三角形。
这里有一些代码来补充马特的回答。
popoverController.popoverPresentationController?.backgroundColor = myColor
或
self.navigationController?.popoverPresentationController?.backgroundColor = myColor