简体   繁体   中英

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.

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?

Thanks in advance!

Callout appears when annotation is selected - you can use mapView:didSelectAnnotationView: method in delegate to track that event. Callout hides when annotation is deselected - use mapView:didDeselectAnnotationView: method to track that event.

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.

You may additionally implement an observer for this property, to implement your functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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