Tom Hamming Tom Hamming - 7 months ago 126
iOS Question

How can I change the opacity of the overlay behind UIPopoverPresentationController?

I'm using

to present popovers in an iOS app. I want to dim the background behind the popover when it comes up. How can I do this? Is there an API for it somewhere, or am I going to have to overlay something on the main view when I present the popover?


I ended up solving this by putting my own overlay over my main view when I present the popover. I was able to do this easily because I do all my popovers through one singleton coordinator class, my root view controller isn't a navigation controller, and I can get to it easily everywhere. I also had to create a subclass of UINavigationController everywhere I presented one in a popover so I could override dismissViewControllerAnimated:completion: and notify the coordinator so it removed the overlay (the didDismiss delegate method doesn't get called when the popover is dismissed programmatically).