5

I have had a look around online to try and find out the best way to draw a line showing the route a user has travelled. I think I need to use the MKOverlayView, and I guess I need to collect a selection of data points to plot (would these be GPS coordinates?). The question I have is based on how I would draw the line and keep adding to it as the users location updates?

I also want to be able to clear the line when a user presses a button. How would I implement this (not the button press, just the code to clear the line off the map view)?

Thanks in advance!

  • 1
    http://stackoverflow.com/questions/5673303/how-to-draw-arc-curve-line-with-mkoverlayview-on-mkmapview – Jacob Jennings Oct 13 '11 at 21:23
  • 2
    Also look at Apple's [Breadcrumb sample app](http://developer.apple.com/library/ios/#samplecode/Breadcrumb/Introduction/Intro.html) which does most of what you describe. –  Oct 13 '11 at 21:40

1 Answers1

1

You can do this using MKPolyline. At First you need to get coordinates of route, then draw polylines over it. You will find an example here to draw polyline over some coordinates.

Abdullah Md. Zubair
  • 3,317
  • 2
  • 28
  • 38