Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIPopoverController Not Animating

I have an iPad app that has an MKMapView embedded in a UINavigationController which is displayed in a UITabBar. I am displaying a popover controller over the map with

UIPopoverController *myPopoverController =
    [[[UIPopoverController alloc] initWithContentViewController:myContentView]
     autorelease];

[myPopoverController presentPopoverFromRect:myRect
                                     inView:mapView
                   permittedArrowDirections:UIPopoverArrowDirectionAny
                                   animated:YES];

The popover displays fine. However, it does not have the nice animated effect: it just immediately appears onscreen. Similarly, when I dismiss it it just disappears without any animation.

Anybody have any idea how I can get the animation to work? Should I try displaying it from another view? Is there some property on something that I might have neglected to set?

like image 768
Kristopher Johnson Avatar asked Feb 03 '23 20:02

Kristopher Johnson


2 Answers

Despite the animated:(BOOL) parameter, it appears popovers never animate when presented. I've tried a dozen first and third party apps.

The dismissal should animate however, provided you pass YES to dismissPopoverAnimated:(BOOL)

like image 66
mxcl Avatar answered Feb 13 '23 07:02

mxcl


Assuming your popover animates outside the map view, I would try placing the map view into a container view whose frame is the same size as the map view's. From there, it's trivial to present the popover in the container view.

According to Apple's documentation, MKMapView isn't supposed to be subclassed, so like UIWebView, it strikes me as one of those views whose guts are better left untouched.

like image 37
Joshua Pokotilow Avatar answered Feb 13 '23 07:02

Joshua Pokotilow