Reload or refresh MKMapView based on various settings or sort types

I have an application in which the map view has several contacts and annotations. These contacts should be updated or reloaded based on the various sorting options that I have in my view. for example, Pins are various buildings, and filter parameters are similar to: Library, Museum, Cinema, All attractions, etc.

I tried using

[MapView reloadInputViews]; 

based on the filtered array after selecting an option. But that just doesn't work for me. Any ideas how this will be implemented? Thanks in advance!

+4
source share
3 answers

Since your filter parameters are completely different entities, you should simply delete all the contacts on your card, and then loop the corresponding array with the new filtered data to add new contacts.

+3
source

Use [MKMapView removeAnnotations:] and [MKMapView addAnnotation:] to change the contacts that are on the map.

+7
source
  • remove all annotations using [MKMapView removeAnnotations:] 2. recreate the annotation array based on the new sort. 3. Add a new annotation to the map.
+2
source

All Articles