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?
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)
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.
精彩评论