开发者

How to forward touches to MKMapView

开发者 https://www.devze.com 2023-01-31 12:40 出处:网络
how do I forward touches from the parent view that, in my case, is a MKMapView? The idea, basically, is to splash a view with a spinner that is semi-transparent but I, also, want the user to move the

how do I forward touches from the parent view that, in my case, is a MKMapView?

The idea, basically, is to splash a view with a spinner that is semi-transparent but I, also, want the user to move the map beyond this view. I just want to pretend the view isn't there and this view just forwards the touches on the parent view (since this spinner view is a subview of MKMapView).

I found a bad way to do that (I sincerely haven't tried it and I don't think I will) that is using some undocumented APIs:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UIScrollView * view = [[[[mapView subviews] objectAtIndex:0] subviews] objectAtIndex:0];
    [view touchesMoved:touches withEvent:event];
}

I have also found the WildcardGestureRecognizer approach as discussed HERE but I think it is so much powerful compared to the trivial goal I am trying to achieve.

Any ideas o开发者_如何学编程n how to do this easily?

Thank you!


I believe it is enough to set userInteractionEnabled = NO on the overlay view. IIRC, the underlying view will then receive the touches.

0

精彩评论

暂无评论...
验证码 换一张
取 消