Force MKMapView viewForAnnotation to update

后端 未结 5 1061
忘掉有多难
忘掉有多难 2021-02-12 22:05

So I have a MKMapView with all my pins added, and the colour of the pin is dependent on whether a value is set for that pin. When I first load the app, viewForAnnotation

5条回答
  •  [愿得一人]
    2021-02-12 22:35

    Swift 2.1:

    I had the same issue, and found a quick solution, trigger this when needed, also sending it to the main thread would be wise:

    var annotationsArray = mapView.annotations
    mapView.removeAnnotations(mapView.annotations)
    mapView.addAnnotations(arrayIncs)
    arrayIncs.removeAll()
    

提交回复
热议问题