简体   繁体   中英

How to Switch between Clustered and Non Clustered Annotations in Apple Map IOS

So My requirement is pretty straight forward. i Have a switch on map which will allow the users to select the style in which the map annotations should look like

1. Clustered annotations ( apples default clustering when annotations collide)
2. Non clustered annotations ( no clustering even if annotations collide)

The method i am using right now is to remove all annotations from map first then add them back. i am using custom annotations for both cluster and normal case

on moving from non clustered to clustered everything works as expected But in reverse case when the clustered icons changed to non clustered some of the annotations are missing from map.

i am setting the clusterIdentifier = nil when i change to non cluster mode and the displayPriority =.required

any suggestions??

OK. I have made the switching annotation style work by using 2 different identifiers for the 2 view styles and removing and adding all the annotations on Switching.

so when user opens the app default Identifier is used
When User Switches the style
Remove all annotations -> Add all annotations -> Use the identifier for the selected Style

Now This will work for me. But what i understood from this issue is that the dequeuing annotationView in apple map has some issues when using same annotationview to display differently

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