Hiding and disabling user interaction on a MapKit

2019-02-26 07:20发布

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条回答
姐就是有狂的资本
2楼-- · 2019-02-26 08:04

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.

查看更多
登录 后发表回答