To know when the user drags the map, you need a delegate on the MKMapView, and respond to regionWillChangeAnimated and regionDidChangeAnimated. The documentation claims that these may be called multiple times during a drag, but I don't see that happening.
However, see this discussion of these delegate methods not being called reliably.
Edit: my original answer suggested using Core Animation to fade the popover, but this isn't feasible. See the comments. Even if you get the popover's contentViewController
, and get its view
, and change that view's alpha
, the popover leaves a shadow unless you go searching through the layer hierarchy. If at all possible, dismiss
and present
the popover instead. This may be less convenient than Core Animation, as you may need an NSTimer
to control the delay before it is restored.
For other views on top of map views, once you know when dragging is happening, use Core Animation to fade your popover out and back in again. Adjust the durations, delays and name of the view to fade to suit.
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
{
[UIView animateWithDuration:0.25 delay:0.0 options:UIViewAnimationOptionAllowUserInteraction animations:^
{
[[self viewOnTopOfMapView] setAlpha:0.0];
}
completion:nil];
}
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
{
[UIView animateWithDuration:0.25 delay:2.0 options:UIViewAnimationOptionAllowUserInteraction animations:^
{
[[self viewOnTopOfMapView] setAlpha:1.0];
}
completion:nil];
}