【问题标题】:Get direction to location iOS 6 using longitude and latitude使用经度和纬度获取位置 iOS 6 的方向
【发布时间】:2014-02-07 08:07:51
【问题描述】:

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

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

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

有人有这方面的例子吗?

【问题讨论】:

    标签: ios objective-c ios6 mapkit


    【解决方案1】:

    您可以在 iOS 6 中使用 MKMapItem 执行此操作: (请注意,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-11-08
      • 1970-01-01
      • 1970-01-01
      • 2013-05-14
      • 1970-01-01
      • 1970-01-01
      • 2021-09-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多