问题
I'm trying to hide a pin on a MapKit view, and while setting the hidden
property to YES
works, I can still tap on it and get didSelectAnnotationView
messages!. Naturally, I tried setting userInteractionEnabled
to NO
, but I'm still receiving the messages.
This is what I've tried. a
is my annotation view.
a.hidden = YES;
a.layer.hidden = YES;
a.userInteractionEnabled = NO;
There's something that I'm missing here, and I've Googled everywhere and can't find anything that works. Any clues?
回答1:
The enabled
property of MKAnnotationView
can be set to NO
to disable selection as the documentation states:
If the value of this property is NO, the annotation view ignores touch events and cannot be selected.
来源:https://stackoverflow.com/questions/9492308/hiding-and-disabling-user-interaction-on-a-mapkit-pin