Ich möchte die Richtung zwischen zwei Markern zeigen, die ich gemacht habe. Wie kann ich es tun? Wie kann ich die Richtung anzeigen?Wie zeichnet man eine Route zwischen zwei Markern in Google Maps (swift)?
Hier ist mein Code, den ich Marker machen verwendet:
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 Markierungen auf Klick zu löschen:
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 die Marker für das Ziel ist zeigen, und welches ist für den Ursprung.
wie kann ich es verwenden?! –
Auf die gleiche Weise verwenden Sie 'GMSMarker' wie oben. –
können Sie mir den vollständigen Code dafür geben!? –