从注释中打开第三方导航应用程序,请单击

时间:2018-10-21 18:51:21

标签: swift swift4

我希望我的用户单击一个注释,并看到一个操作表,以在他们选择的已安装应用程序中打开该特定注释(为简单起见,我只想检查Apple Maps,Google Maps和位智)。我正在努力寻找一种方法,可以在我的注释中添加点击动作,然后在导航应用中实际打开该位置。

class SearchResults 
{
 @IBOutlet weak var mapView: MKMapView!
    func viewDidLoad()
    {
            super.viewDidLoad()
            for index in 0...documentKeysWithinRadius.count - 1
            {
                let documentKeyLocation = documentKeysWithinRadius[index]["location"] as! CLLocation
                let annotation = MKPointAnnotation()
                annotation.coordinate = documentKeyLocation.coordinate
                annotation.title = documentKeysWithinRadius[index]["documentID"] as! String
                mapView.addAnnotation(annotation)
            }
            mapView.showAnnotations(mapView.annotations, animated: true)
}

0 个答案:

没有答案