Josh Kahane
Josh Kahane

Reputation: 17169

UIPopoverController Button, Prevent Dimming Overlay?

When presenting a UIPopoverController from a UIButton the entire screen behind the popover is dimmed.

Is it possible in some way or another to prevent the presenting button (the one pressed to show the popover) from being dimmed?

Upvotes: 1

Views: 192

Answers (1)

Sulthan
Sulthan

Reputation: 130191

I remember solving this problem when it has appeared the first time on iOS 7. The only solution (if nothing has changed) has 3 parts:

  1. Remove the default background (setting popoverBackgroundViewClass).
  2. Add your own background (I used a subclass of UIPopoverController to handle the appearance callbacks)
  3. Display your button (or any other passthrough views) above the background. You can either remove them from their hierarchy and move them to the same position in the background or just take a screenshot of them and add them to the background.

In the end it's not too difficult but it takes time to debug.

Upvotes: 2

Related Questions