0

I would like to remove existing annotation from mapview. Scenerio is to click on existing annotation callout part (disclosureindicator button) and it would lead user to another viewcontroller and shows a button you could remove the selected annotation. Actually, I am working on to create exactly same google map application, that is part I am struggling now. Any help would be appreciated! enter image description here

Craig
  • 8,093
  • 8
  • 42
  • 74
casillas
  • 16,351
  • 19
  • 115
  • 215

1 Answers1

1

The MKMapView class has two methods you need to add/remove annotations:

addAnnotation: id <MKAnnotation>
removeAnnotation: id <MKAnnotation>

You'd create a class that implements the protocol MKAnnotation. Here's an example in another SO question: MKAnnotation, simple example

Community
  • 1
  • 1
abellina
  • 1,016
  • 1
  • 11
  • 27
  • my question is to know how to go to second view controller once I click on disclosure indicator button on the top of the annotation. removing/adding annotation is quite simple. – casillas Sep 26 '12 at 12:04
  • 1
    Ok that wasn't clear. So when you tap on the disclosure you need to implement this in your mapview delegate: - (void) mapView: (MKMapView*) mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control; From this function you could allocate a new view for example and push it to a navigation controller, or present it modally, really there are many options to follow, so you'll have to be more specific. – abellina Sep 26 '12 at 13:24
  • oki, superr I got it. thanks a lot. I would like to ask how you get the portion of the map above showing in the second viewcontroller above.? – casillas Sep 26 '12 at 21:03
  • http://stackoverflow.com/questions/12611080/google-app-thumbnail-map-image-mkannotation – casillas Sep 26 '12 at 22:01