1

我希望在我的应用程序中使用来自 iOS 6 中 Apple 地图的方向。

我已经看到了一些如何做到这一点的例子,但我还没有看到如何使用一个点的经度和纬度坐标来做到这一点。

基本上,我的应用程序使用经度和纬度在地图视图上放置图钉,我想获取到这些位置的路线。

有没有人有这方面的例子?

4

1 回答 1

3

您可以使用MKMapItemiOS 6 中的 an 来执行此操作:(请注意,addressDictionary 是一个字典,其中包含地址簿记录中的键和值 - 有关更多详细信息,请参阅 Apple 文档)

// Create MKMapPlacemark out of coordinates and addressDictionary
MKPlacemark *placeMark = [[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:addressDictionary];

// Create MKMapItem
MKMapItem *destination =  [[MKMapItem alloc] initWithPlacemark:placeMark];

// Using iOS6 native maps app
[destination openInMapsWithLaunchOptions:@{MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving}];
于 2012-12-24T22:20:27.117 回答