MKMapView refresh after pin moves

前端 未结 7 1262
猫巷女王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:02

    if your adding your annoations from a thread it wont work. i had the same problem and just wrapping my function that was adding the annotations with the following worked

    [self performSelectorOnMainThread:@selector(addCameraIconOnMain:) obj waitUntilDone:true];  
    
    -(void) addCameraIconOnMain:(myobjecttype*)obj
    {
        // this isnt the entire function, customize for your own purpose.....
        [mapView addAnnotation:annotation];
    }
    

提交回复
热议问题