Closed mitty810609 closed 6 years ago
First your CafeShopAnnotation
should adopt the CKAnnotation
protocol.
Then, you should add your annotations to the mapView.clusterManager.annotations
(not to the mapView)
Cool brother, but i have another question.
Mapview annotation view only have black view , why ?
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "annotation") ??
MKAnnotationView(annotation: annotation, reuseIdentifier: "annotation")
if annotation.isKind(of: MKUserLocation.self) {
return nil
} else if let cluster = annotation as? CKCluster {
if cluster.count > 1 {
annotationView.canShowCallout = true
annotationView.image = UIImage(named: "cluster")
} else {
annotationView.canShowCallout = true
annotationView.image = UIImage(named: "marker")
}
}
return annotationView
}
And i see your website ClusterKit DEMO , have a message count on annotation view, how to do that ?
For the count in cluster, please refer to #11 All the view are black even if you zoom in?
NB: canShowCallout
of a cluster view should be set to false if you wan to zoom in on touch.
Yes , even zoom in, and after zoom in limited i check the cluster count return 2.
didSelect
view.Annotation
only coordinate have value, title and subtitle are nil.
title and subtitle are nil because it's a cluster annotation. Are you sure that your data set has no duplicates, or annotations with the same position ?
This is my custom annotation
In viewdidload i will handle my store class transform to custom annotation
but view for annotation cast ckcluster fail
what should i do ?