Tidane
Tidane

Reputation: 694

How to reload MKAnnotations without reloading MapView?

I have an app which searches using a Web service for informations about stations, then I get the response JSON. But each time I change the position of the center I have to reload the pins and add new ones, even if they are already on the map.

I can get the response JSON, get the information to display and create the annotations. The problem is when I move the center, it reloads the annotations over the others.

Upvotes: 1

Views: 937

Answers (1)

Tidane
Tidane

Reputation: 694

The problem is I was inserting that method in the method that makes the connection to the web service or when i receive the response...

But I inserted the method in this one in the first line:

- (MKAnnotationView *)mapView:(MKMapView *)mapViewStation viewForAnnotation:(id      <MKAnnotation>)annotation

[map removeAnnotations:map.annotations];

//Code

It rocks. Thanks

Upvotes: 1

Related Questions