Hiding and disabling user interaction on a MapKit pin?

蹲街弑〆低调 提交于 2019-12-31 03:16:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!