众所周知,iOS6.0以后,Apple开始使用自家地图,当然这个自家地图的数据在国内由高德提供,那么我们如何在得知两地的经纬度后开启手机自带的地图获取路由信息呢,各位看官请看:
CLLocationCoordinate2D to;
CLLocationCoordinate2D current;
to.latitude = [s1 doubleValue];;
to.longitude =[s2 doubleValue];
current = self.carCurrentLoaction.coordinate;
MKMapItem *currentLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:current addressDictionary:nil]];
MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:to addressDictionary:nil]];
toLocation.name = @"Destination";
[MKMapItem openMapsWithItems:[NSArray arrayWithObjects:currentLocation, toLocation, nil]
launchOptions:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:MKLaunchOptionsDirectionsModeDriving, [NSNumber numberWithBool:YES], nil]
forKeys:[NSArray arrayWithObjects:MKLaunchOptionsDirectionsModeKey, MKLaunchOptionsShowsTrafficKey, nil]]];
[currentLocation release];
[toLocation release];
关于使用苹果官方地图的一些方法
猜你喜欢
转载自geekduke.iteye.com/blog/1897769
今日推荐
周排行