【发布时间】:2013-05-07 20:27:45
【问题描述】:
我有一个地图视图,里面有一个丢弃的图钉,我想做的是显示从用户当前位置到丢弃的图钉的路线。
我搜索了它,但没有运气,如果有人知道怎么做,请帮忙? :)
提前致谢。
【问题讨论】:
标签: iphone ios objective-c xcode ipad
我有一个地图视图,里面有一个丢弃的图钉,我想做的是显示从用户当前位置到丢弃的图钉的路线。
我搜索了它,但没有运气,如果有人知道怎么做,请帮忙? :)
提前致谢。
【问题讨论】:
标签: iphone ios objective-c xcode ipad
试试看……
您可以使用两种方法来做到这一点:
1.
CLLocationCoordinate2D start = { c_lat, c_long };
CLLocationCoordinate2D destination = { [[dic valueForKey:@"business_lat"]doubleValue], [[dic valueForKey:@"business_long"]doubleValue] };
NSString *googleMapsURLString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f&",start.latitude, start.longitude, destination.latitude, destination.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]];
2.
使用谷歌API
请查看this 了解两个位置之间的绘制路线
在 API 中你只需要传递源名称和目的地名称
希望我能帮上忙……
【讨论】: