I want to show a route on a MKMapView between the current location and a desired location as an annotation.
What is the best way to do this?
I want to show a route on a MKMapView between the current location and a desired location as an annotation.
What is the best way to do this?
You have to compute your self the way points and draw the route as a layer. The is no public api to show route in a MKMapView.
The fastest solution is to open maps app of the phone with the route.
///in .h add delegate
MKMapViewDelegate
///in .m file
I have try following code...it works very well in my project...try it..
First download KMLParser.h and KMLParser.m from this link:-
Also download DDAnnotation.h and DDAnnotation.m file from this link:-
Now Create a View Controller Like SomeViewController.
Add following library:-
In SomeViewController.h import KMLParser.h file.
Write following code in SomeViewController.h
Now in the SomeViewController.xib drag and drop the MapView and give link it with mapView from File's Owner. Also set delegate of MapView to File's owner.
Now in SomeViewController Write the following code:-