UIPopoverController: the odd duck
the post in which I swear a lot
UIPopoverController
, why must you be such an odd duck?
I am finally trying to get Storm Sim updated for iOS 7 and since I need a dark theme the default behavior of "dim the background views" is useless. But you can't just turn that off... oh no sir! You have to subclass UIPopoverBackgroundView
and do the whole thing from scratch, including laying out the arrow.
And you wanted the iOS-6 style drop shadow right? Because I have lots of spare drop shadows laying around here. You sure you don't want a drop shadow? You definitely want a drop shadow.
Pro tip #598435: If you don't want a fucking drop shadow, make sure in your subclass of UIPopoverBackgroundView -layoutSubviews
method that you do not call super's implementation because that sure will bring back a blast from the past in the form of drop shadows, despite what that lying asshole documentation says about +wantsDefaultContentAppearance
.
Did you want to do something like blur the background views, change their appearance, or otherwise do anything sensible? Good news everyone! Design your own protocol with notifications because UIKit sure the fuck isn't going to tell you anything about it.
If you wanted to know when a popover is going to be dismissed, prepare to be disappointed. The delegate only tells you after the fact and never tells you if the popover was dismissed programmatically. Half second animation to fade out the popover, then half second animation to fix the views underneath because hey, user's time is free am-i-rite? Since consistency is the hobgoblin of little minds, kicking off an animation when the popover is appearing runs concurrently.
I am so close to just making the damn thing white and giving up, or just letting users deal with being unable to distinguish the popover background from the underlying views. But hey, as long as you're willing to sear sleepy people's eyeballs, the default dimming behavior works great!
This blog represents my own personal opinion and is not endorsed by my employer.