1

Possible Duplicate:
Show route between current and desired location on iPhone MapView

I am trying to draw a path between two coordinates on a MapView in iOS, but I can't figure out how. I have the two latitude and longitude points in one view.

How can I draw the path between these two points? I've attached the example with this question. Please help me. Any tutorials and code will be appreciated!

enter image description here

Community
  • 1
  • 1
Nivrit Gupta
  • 37
  • 2
  • 7
  • And also refer [iPhone: How to draw line between two points on MapKit?](http://stackoverflow.com/questions/10598322/iphone-how-to-draw-line-between-two-points-on-mapkit) – Ilanchezhian Oct 14 '12 at 14:49

1 Answers1

0

A simple answer is; you can't. At least, not using the built in API methods of iOS.

As far as i've seen so far, you have three alternatives:

  1. Use an external library that offers such functionality - i'm sure there are plenty to be found on GitHub.

  2. Compile the appropriate url and open mobile safari pointing to Google Maps with a directions request.

  3. Use the built in methods of iOS 5/6 to open your route in the native Maps.app

I've used the third method in an app and this works fine but does come with the disadvantage that users will have to leave your application when viewing directions in Maps. It does however remain consistent and not quite as jarring to the user than opening mobile Safari.

If you do find a way to do this inside your own app, i'd be interested in seeing your results.

Zack Brown
  • 5,990
  • 2
  • 41
  • 54
  • can you see this http://stackoverflow.com/questions/30775154/error-400-while-adding-route-on-mkmapview –  Jun 11 '15 at 09:50