Closed happiehappie closed 7 years ago
From what I observe, as long as I add annotation to CCHMapClusterController instead of my mapkit directly, I can't reference my DiscoverMapAnnotation
Hi – once you created a custom MKAnnotation
with your property just add it to the map cluster controller with addAnnotations
as you described in your comment.
At which point do you need access to the annotation you have added? mapView:viewForAnnotation:
will give you the annotation directly whereas the delegate calls for CCHMapClusterController
will pass you a CCHMapClusterAnnotation
with your annotation in the annotations
array.
@choefele Thank you so much for you comment really... I didn't have my concept right about my custom annotation is INSIDE CCHMapClusterAnnotation. Feel free to close this now. And again, thank you for the swift reply and the input really.
I have a custom subclass of MKAnnotation with extra property: Image etc However, in my viewForAnnotation delegation method,
if annotation is DiscoverMapAnnotation { print("I want youuu") } else if let annotation = annotation as? CCHMapClusterAnnotation { print("NOOO") }
always prints NOOO. this is how I addAnnotation
self.mapClusterController.addAnnotations([DiscoverMapAnnotation(id: location.id, location: location.location, thumbnailUrl: location.thumbnailUrl, coordinate: CLLocationCoordinate2D(latitude: Double(location.location.latitude)!, longitude: Double(location.location.longitude)!))], withCompletionHandler: nil)
Am I doing anything wrong?