当我使用谷歌地图SDK时,我正试图在iOS上的两个位置之间获得驾驶方向.我知道我们可以用两种方法做到这一点: -
1.)使用URL方案,您的设备上必须安装Google Maps App.
2.)使用Directions API,通过Request-Response然后解析JSON.显示标记以显示方向.
现在,我的问题是,我可以通过其他任何方式在iOS上执行此操作吗?我需要显示从当前位置到我有Lat/Long的特定位置的方向.
我的意思是,真的不可能简单地传递2个位置作为参数和谷歌地图SDK,会给我指示吗?
谢谢,
我想在两个标记(例如 Uber)之间画一条曲线,但没有办法做到这一点。有什么想法吗?
我想显示我制作的两个标记之间的方向。我该怎么做?如何显示方向?
这是我用来制作标记的代码:
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)
}
Run Code Online (Sandbox Code Playgroud)
这是用于在单击时删除标记的代码:
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") …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用谷歌地图进行方向和显示路线.我已经做了所有的事情,但是我无法绘制虚线以连接从我的位置或建筑物的起点.
查看我的应用截图截图1
现在我想绘制像google-maps截图2一样的虚线
任何建议和意见将不胜感激