ClassmapItemClass=[MKMapItemclass];if(mapItemClass&&[mapItemClassrespondsToSelector:@selector(openMapsWithItems:launchOptions:)]){// For iOS 6CLLocationCoordinate2DdestCoord=CLLocationCoordinate2DMake(destLat,destLng);//目标经纬度坐标MKPlacemark*destPlacemark=[[MKPlacemarkalloc]initWithCoordinate:destCoordaddressDictionary:nil];MKMapItem*destMapItem=[[MKMapItemalloc]initWithPlacemark:destPlacemark];MKMapItem*currentMapItem=[MKMapItemmapItemForCurrentLocation];[MKMapItemopenMapsWithItems:@[currentMapItem,destMapItem]launchOptions:@{MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving}];}else{// For iOS 5 and before.NSString*urlEncodedCurrentPlaceName=[@"当前位置"stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];NSString*mapLink=[[NSStringalloc]initWithFormat:@"http://maps.google.com/maps?daddr=%f,%f&saddr=%@",destLat,destLng,urlEncodedCurrentPlaceName];[[UIApplicationsharedApplication]openURL:[[NSURLalloc]initWithString:mapLink]];}