ribl / FBAnnotationClusteringSwift

Swift translation of FB Annotation Clustering, which clusters pins on the map for iOS.
http://ribl.co/blog/2015/05/28/map-clustering-with-swift-how-we-implemented-it-into-the-ribl-ios-app/
MIT License
311 stars 109 forks source link

When cluster covers user's location - it gets impossible to select, is there any workaround for that? #53

Open nalogowiec opened 8 years ago

nalogowiec commented 8 years ago

In the didSelectAnnotationView method I have this code:

func mapView(mapView: MKMapView, didSelectAnnotationView view: MKAnnotationView) {
        mapView.deselectAnnotation(view.annotation, animated: true)

        if view.annotation!.isKindOfClass(FBAnnotationCluster) {
             print("cluster selected")
        } else {
            if !(view.annotation is MKUserLocation) {
                  print("single pin selected")
            }
            else{
                  print("MKUSERLOCATION selected")
            }
        }
}

now the problem is when user zooms out the map and cluster is in the same location as user's default location. Then, when I touch the cluster, instead of seeing "cluster selected" I see "MKUSERLOCATION selected". Is there any way of completely ignoring mkuserlocation selection and select cluster then?

This happens of course when I'm displaying user's location:

mapView.showsUserLocation = true