3

I need to show all MKPointAnnotations added to MKMapView all the time, but they keep hiding when zooming in and out the map, is there a property o delegate method to prevent this behavior ?

Thank you!.

Here is my code:

var _mapviewMap: MKMapView!
var _mapAnnotations:[MKPointAnnotation] = []

Then add annotations to the map:

for item in _resultSet {

        guard let itemCoordinates = item.location?.coordinate else {
            continue
        }

        let annotation = MKPointAnnotation()
        annotation.title = item.name ?? ""
        annotation.coordinate = CLLocationCoordinate2D(latitude: itemCoordinates.latitude, longitude: itemCoordinates.longitude)
        _mapviewMap.addAnnotation(annotation)
        _mapAnnotations.append(annotation)
}

Thats it, not using any delegate methods. I would like to point out that annotations reappear when I zoom in again, it's more like a default behavior I would like to prevent.

0 Answers0