【发布时间】:2016-10-16 08:27:45
【问题描述】:
我想在我制作的两个标记之间显示方向。我该怎么做?如何指示方向?
这是我用来制作标记的代码:
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)
}
这里是点击删除标记的代码:
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
}
我喜欢显示哪个标记用于目的地,哪个标记用于起点。
【问题讨论】:
标签: swift google-maps routes direction