简体   繁体   English

如何检测注释的标注正在mapview上显示?

[英]how to detect a callout of an annotation is showing on mapview?

I have a checkin related app. 我有一个签入相关的应用程序。 When user clicks a venue on map, callout will popup and show its name and address. 当用户点击地图上的场地时,将弹出标注并显示其名称和地址。 At the same time, if the venue is within 1000m from current location, a check in button will be displayed. 同时,如果场地距离当前位置1000米以内,将显示一个登记入住按钮。

To a venue that can checkin, all I want is, 对于可以登记的场所,我想要的只是,

when callout is popup, check in button shows. 当弹出标注时,检查按钮显示。 when callout is disappear, that button disappears too. 当标注消失时,该按钮也会消失。

Now show button works well, but I don't know how to detect callout visible status. 现在显示按钮效果很好,但我不知道如何检测标注可见状态。 Is there any callback method that callout show/hide? 是否有任何callout show / hide的回调方法?

Thanks in advance! 提前致谢!

Callout appears when annotation is selected - you can use mapView:didSelectAnnotationView: method in delegate to track that event. 选择注释时会显示标注 - 您可以在委托中使用mapView:didSelectAnnotationView:方法来跟踪该事件。 Callout hides when annotation is deselected - use mapView:didDeselectAnnotationView: method to track that event. 取消选择注释时,Callout会隐藏 - 使用mapView:didDeselectAnnotationView:方法来跟踪该事件。

As you can see here it is about selected property of MKAnnotationView, which is saying that If the property contains YES, the annotation view is displaying a callout bubble. 正如你在这里看到的那样它是关于MKAnnotationView的选定属性,它说如果属性包含YES,则注释视图显示一个标注气泡。

You may additionally implement an observer for this property, to implement your functionality. 您还可以为此属性实现一个观察者,以实现您的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM