lundi 18 juillet 2016

Show Annotation Title and SubTitle in Custom MKPinAnnotationView

I am using MKPinAnnotationView inside my App. I am setting MapView object as delegate, and using this code for customising my AnnotationView func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? { if annotation is MKUserLocation { //return nil so map view draws "blue dot" for standard user location return nil } let reuseId = "pin" var pinView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId) as? MKPinAnnotationView if pinView == nil { pinView = MKPinAnnotationView(annotation: annotation, reuseIdentifier: reuseId) // pinView!.canShowCallout = true pinView!.image = UIImage(named:"store.jpg") pinView!.animatesDrop = true pinView!.pinTintColor = UIColor.darkGrayColor() } else { pinView!.annotation = annotation } return pinView } I am getting custom AnnotationView as I required.However, I am missing the features of title and subtitle of MKPointAnnotation. I wish to see title and subtitle for the grey dots.

Aucun commentaire:

Enregistrer un commentaire