ios - swift 4 : How to redraw route if user change the direction in Google map ios

标签 ios google-maps swift4.1

我正在开发一个 iOS 应用程序,该应用程序使用折线选项在 map 上绘制源到目的地之间的路径。

这很好用。

我需要的是,如果用户从源开始,并且用户没有选择通往目的地的绘制路线,而是选择另一条路线,则应该为用户当前的路径重新绘制 map 上的路径。

我正在使用 Directions API 绘制路径。

我该怎么做?

提前致谢。

最佳答案

是的,您可以通过检测位置的变化来做到这一点。使用 CLLocationManagerDelegate 协议(protocol)的 didUpdateLocations 方法来检测位置的变化。如果用户位置发生重大变化,则使用 GMSGeometryContainsLocation 函数检查用户是否仍在路线上。

关于ios - swift 4 : How to redraw route if user change the direction in Google map ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53553541/

相关文章:

ios - 如何使用json和swift 4.1在Google map 上添加多个标记?

ios - 我想在第一次打开应用程序时创建提醒

ios - 设置 self.delegate = self 是不是糟糕的设计

css - firefox 中的相对位置导致 google-map-markers 可点击区域出现问题

javascript - Google Maps API 没有将正确的位置居中

swift - 如何使用 swift 和 firebase 进行分页?

iOS 应用程序二进制提交 : submitted from Xcode but it does not appear in iTunes Connect

ios - 如何在 iOS UITableViewController 上显示来自 phpMyAdmin 的一行数据

javascript - Google map API 门牌号未显示

arrays - 采用数组和字典的协议(protocol)