IN my project I need to draw a route between two pins. Can anyone tell me what are the methods used. And give me the example code for that.
-
Try the response to this similar question - http://stackoverflow.com/questions/1085749/google-map-route-draw-on-iphone – lostInTransit Nov 09 '11 at 12:10
3 Answers
Try these posts.. It will help you i think
http://spitzkoff.com/craig/?p=108
This will automatically use Google Direction API and will fetch the points in between the locations i guess..
Anyhow see this blog http://laurilarjo.wordpress.com/2010/10/23/using-google-directions-api-and-drawing-routes-in-iphone-mkmapview/

- 16,485
- 4
- 59
- 58
You can use MKPolyLineView - it allows you to draw a line (or polyline, if you need several segments) as an overlay on top of the MKMapView. Apple even has example code using this here.
Note that this method uses an MKOverlayView which was added in iOS 4, so it only works in iOS 4+. If you need to target iOS 3 devices, then you can use the MKAnnotationView hack that others have linked to (originating as far as I can tell from that spitzkoff blog post). I used to do it that way, but did away with it when iOS 4 had matured enough - I'd wholeheartedly recommend doing it the new way if you don't need iOS 3 support.
As for pins, use MKPinAnnotationView

- 2,987
- 4
- 20
- 29
Go to google maps. "Get directions". Make a screenshot. Then use UIImageView. This is what I would do.

- 1,181
- 8
- 17