iphoneios6mkmapviewmkannotationviewmkpinannotationview

How we can put label on custom pin in MapKit?


I want to display a dynamic label on custom pin. I used MKMapView, CLLocationManager,MKAnnotationView and MKPinAnnotationView. So, please help me friends.

Like:

enter image description here


Solution

  • If you mean you want the pin to have a letter on it then you need to set the image of the annotation view in viewForAnnotation. If you're planning to change the pin for each annotation you'll need to create the image dynamically. They will be plenty of code around this but it comes down to this

    annotationView.image = anImage;