I'm trying to change the default popover arrow color for a popover defined as a storyboard segue (not built programmatically) from a button. The following picture shows the white default popover arrow:

When I add
navigationController?.popoverPresentationController?.backgroundColor = myNavBarColor
to the viewWillAppear method of the UIViewController presented in the popover, the result is the following:

Defining a new UIPopoverBackgroundView class for the UIPopoverPresentationController during the prepareForSegue method of the main UIViewController is "too late".
I hope there'll be a simple fix (with the same storyboard segue as popover) for such a common issue.
Set the background color of the popoverPresentationController of your viewController :
let viewController = YOUR_VIEW_CONTROLLER
viewController.modalPresentationStyle = .popover
if let presentation = viewController.popoverPresentationController {
presentation.backgroundColor = UIColor.white
}
present(viewController, animated: true, completion: nil)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With