在我的应用程序中,我使用MKPolyline来跟踪用户的路径。有时(而不是全部时间,我不明白),当一个新的线段被添加到地图中时,整条线闪烁。有时它不会。这是用于添加行的代码:MKOverlay更新闪烁
CLLocationCoordinate2D coords[2];
coords[0] = CLLocationCoordinate2DMake(newLocation.coordinate.latitude, newLocation.coordinate.longitude);
coords[1] = CLLocationCoordinate2DMake(oldLocation.coordinate.latitude, oldLocation.coordinate.longitude);
MKPolyline* line = [MKPolyline polylineWithCoordinates:coords count:2];
[mapView addOverlay:line];
我错过了什么吗?
编辑:这通常发生在应用程序从发送到后台返回时。我不确定为什么,但是,因为我只是添加覆盖层,而不是修改整个mapView.overlays数组。 ...对?
那么,当一个新的细分受众群被添加或该应用程序从背景中返回时?也许是两者的结合? –
当从后台返回后添加新段时发生。这是否与从后台线程添加段的事实有关? –