iOS refresh annotations on mapview

后端 未结 7 1649
悲&欢浪女
悲&欢浪女 2021-01-02 10:01

I have a mapview where the annotation\'s coordinates are constantly being updated but when I use setCoordinate, the annotation does not move. How do I refresh the annotation

7条回答
  •  Happy的楠姐
    2021-01-02 11:00

    Dispatch the add annotation to the main thread rather then attempt to modify the UI on a background thread

    dispatch_async(dispatch_get_main_queue()) {
        self.mapView.addAnnotation(annotation)
    }
    

提交回复
热议问题