iPhone SDK Tips & Tricks
Download
http://blog.kadirpekel.com/wp-content/uploads/MapWithRoutes.zipInclude MapView, Place, PlaceMark, and RegexKitLite file (.h and .m) to your code
Target Info, find Other Linker Flags, add "-licucore"
code:
MapView* mapView = [[[MapView alloc] initWithFrame:
CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)] autorelease]; |
[self.view addSubview:mapView]; |
Place* home = [[[Place alloc] init] autorelease]; |
home.description = @ "Sweet home" ; |
home.latitude = 41.029598; |
home.longitude = 28.972985; |
Place* office = [[[Place alloc] init] autorelease]; |
office.description = @ "Bad office" ; |
office.latitude = 41.033586; |
office.longitude = 28.984546; |
[mapView showRouteFrom:home to:office]; |
source:
http://blog.kadirpekel.com/2010/05/30/drawing_routes_onto_mkmapview_using_unofficial_google_maps_directions_api/