MKMapView refresh after pin moves

前端 未结 7 1246
猫巷女王i
猫巷女王i 2020-12-14 23:42

A custom AnnotationView is updated with new coordinates. But the problem is that it visually updates only after some manipulations with MKMapView, e.g. zooming or moving. Wh

7条回答
  •  离开以前
    2020-12-15 00:04

    The answer here is NOT to refresh the MapView or the Annotation!

    the coordinate property of MKAnnotation has KVO on it. If you just add the id pointer, of the object you want on the map, to the mapview and update the coordinate property with a new location, MKMapView will do the rest for you.

    As close as you can get to a free lunch!

提交回复
热议问题