Updating MKannotation image without flashing

前端 未结 3 1688
孤独总比滥情好
孤独总比滥情好 2021-02-06 19:33

I want to update the images of some of my annotations on a mapview every 5 seconds, however I dont\' want to remove and re-add them to the map as this causes them to \'flash\' o

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 19:48

    In the case where the annotation is not nil, instead of adding and removing, try this:

    annotation.customImage = ... //the new image
    MKAnnotationView *av = [self.mapView viewForAnnotation:annotation];
    av.image = annotation.customImage;
    

提交回复
热议问题