Search code examples
iphonedrag-and-dropmkmapviewmkannotationview

How to change title of a dragged mkannotationview


I want to change the title of a mkannotationview when I drag it. MKannotationview doesn't have title property - i have a custom view for it. So how do I access it in the dragstate delegate method?

  -(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view 
  didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:
  (MKAnnotationViewDragState)oldState
   {
   NSLog(@"old state, new state:%d, %d",oldState,newState);
   //view setTitle
   }

If i can call the viewforannotationdelegate method from here, that can help. So is that atleast possible?


Solution

  • This is the correct casting :

                 ParkPlaceMark *annotation = (ParkPlaceMark *)view.annotation;
    

    Placemark - My custom class; view - mkannotationview