- (void)openMapWithLat:(NSString *)lat Lon:(NSString *)lon Desc:(NSString *)desc;
{
CLLocationCoordinate2D endCoor = CLLocationCoordinate2DMake([lat floatValue], [lon floatValue]);
MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:endCoor addressDictionary:nil]];
toLocation.name = [desc description];
[MKMapItem openMapsWithItems:@[currentLocation, toLocation]
launchOptions:@{MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving,MKLaunchOptionsShowsTrafficKey: [NSNumber numberWithBool:YES]}];
}
iOS 调用系统自带高德地图导航
最新推荐文章于 2021-12-05 18:25:42 发布