Create multiple MKOverlays of polyline from locations coming via web-service

落花浮王杯 提交于 2019-12-08 06:35:27

You could collect an array of those tracks that relate to other users, and keep a single track for the current user. If you clean the array at the start of the connectionDidFinishLoading function and populate it where you are currently adding the overlays to the map, then you move the addOverlay to a new function that you call at the end.

- (void) resetMap
{
  if (showOtherTracks)
  {
      [mapView addOverlays:otherUserTracks];
  } else {
      [mapView removeOverlays:otherUserTracks];
  }
  if (showMyTrack)
  {
      [mapView addOverlay:myTrack];
  } else {
      [mapView removeOverlay:myTrack];
  }
}

You can also call this when ever the button is pressed and the state changes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!