Wie zeichnet man eine Strecke zwischen zwei Markierungen in google maps (swift )?

Möchte ich zeigen Richtung zwischen zwei Markierungen, die ich gemacht hatte. Wie kann ich es tun? Wie kann ich zeigen Richtung?

Hier ist mein code, den ich verwendet, um Marker:

func mapView(mapView: GMSMapView, didLongPressAtCoordinate coordinate: CLLocationCoordinate2D) {
    if counterMarker < 2
    {
        counterMarker += 1
        let marker = GMSMarker(position: coordinate)
        marker.appearAnimation = kGMSMarkerAnimationPop

        marker.map = mapView
        marker.position.latitude = coordinate.latitude
        marker.position.longitude = coordinate.longitude

        print(marker.position.latitude)
        print(marker.position.longitude)

    }

Und hier ist der code für das löschen von Markierungen auf klicken Sie auf:

func mapView(mapView: GMSMapView, didTapMarker marker: GMSMarker) -> Bool {

        let alert = UIAlertController(title: "Alert", message: "Are you Sure for deleting ?!", preferredStyle: UIAlertControllerStyle.Alert)
        alert.addAction(UIAlertAction(title: "No", style: UIAlertActionStyle.Default) {
            UIAlertAction in
            NSLog("No Pressed")


            })
        alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Default) {
            UIAlertAction in
            NSLog("Yes Pressed")
            marker.map = nil
            self.counterMarker -= 1

        })

        self.presentViewController(alert, animated: true, completion: nil)

        return true
    }

Und ich mag zu zeigen, die Markierung für die Ziel-und welches ist für origin.

InformationsquelleAutor P.Tb | 2016-06-15
Schreibe einen Kommentar