在MapKit引脚上隐藏和禁用用户交互? [英] Hiding and disabling user interaction on a MapKit pin?

查看:81
本文介绍了在MapKit引脚上隐藏和禁用用户交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试隐藏MapKit视图上的图钉,并将隐藏属性设置为 YES 工作,我仍然可以点击它并获得 didSelectAnnotationView 消息!当然,我尝试将 userInteractionEnabled 设置为,但我仍然收到消息。

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.

这就是我尝试过的。 a 是我的注释视图。

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?

推荐答案

已启用属性 MKAnnotationView 可以设置为以禁用选择文档声明:

The enabled property of MKAnnotationView can be set to NO to disable selection as the documentation states:


如果此属性的值为NO,则注释视图将忽略触摸事件,并且无法选择。

If the value of this property is NO, the annotation view ignores touch events and cannot be selected.

这篇关于在MapKit引脚上隐藏和禁用用户交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆