打开地图并选择车/步行/自行车道

时间:2016-02-24 15:56:38

标签: ios apple-maps

我被卡住了...如果你开车/骑自行车/徒步旅行,你有什么方法可以选择屏幕吗?我得到这个图像

enter image description here

但我想要这个。

enter image description here

这是我的方法

   /*
    *   Open navigation and start to navigate
    */
    @IBAction func navigationStart(sender: AnyObject) {

        let lat1 : NSString = self.targetLatitudeString
        let lng1 : NSString = self.targetLongtitudeString

        let latitute:CLLocationDegrees =  lat1.doubleValue
        let longitute:CLLocationDegrees =  lng1.doubleValue

        let regionDistance:CLLocationDistance = 10000
        let coordinates = CLLocationCoordinate2DMake(latitute, longitute)
        let regionSpan = MKCoordinateRegionMakeWithDistance(coordinates, regionDistance, regionDistance)
        let options = [
            MKLaunchOptionsMapCenterKey: NSValue(MKCoordinate: regionSpan.center),
            MKLaunchOptionsMapSpanKey: NSValue(MKCoordinateSpan: regionSpan.span)
        ]
        let placemark = MKPlacemark(coordinate: coordinates, addressDictionary: nil)
        let mapItem = MKMapItem(placemark: placemark)
        mapItem.name = nameString
        MKMapItem.openMapsWithItems([mapItem], launchOptions: options)
    }

1 个答案:

答案 0 :(得分:0)

let options = [MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeDriving]

这将做魔术