2017-10-13 5 views
0

J'ai essayé le nouvel iOS 11 MKMarkerAnnotationView, et finalement le cluster fonctionne comme un charme. Mais le problème est que les clusters ont la mauvaise couleur comme vous pouvez le voir sur l'image. Comment puis-je contrôler cela? Wrong cluster colorMKMarkerAnnotationView couleur de cluster

Répondre

1

Nevermind J'ai réussi à comprendre.

J'ai ajouté ce qui suit à la fonction mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) du délégué.

if let cluster = annotation as? MKClusterAnnotation { 
    markerAnnotationView.glyphText = String(cluster.memberAnnotations.count) 
    markerAnnotationView.markerTintColor = UIColor.appPrimary 
    markerAnnotationView.canShowCallout = false 

    return markerAnnotationView 
}