如何完全着色UIPopoverPresentationController背景颜色?

Mar*_*rio 16 cocoa-touch background-color uiview ios

我正在使用白天和黑夜模式的应用程序.问题是,当只是设置视图的背景颜色然后使用它作为"呈现为弹出"时,几乎没有白色文物(见图)

有没有一种简单的方法来解决这个问题?我可能要写自己的UIView吗?

在此输入图像描述

mat*_*att 16

您可以设置UIPopoverPresentationController backgroundColor.如果这还不够,则必须自定义popoverUIPopoverBackgroundView.这使您可以控制整个弹出窗口背景,包括小三角形.

  • "对不起,你介意给我一个小例子或指南"当然:https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/bk2ch09p476popovers/ch22p751popovers/MyPopoverBackgroundView.swift (3认同)