答案 0 :(得分:1)
我发现的最简单的方法是在主多段线下方绘制一条较粗的线,从而在主多段线的两侧添加笔触。
定义主折线时,添加一个zIndex:
mainPolyline.strokeColor = UIColor.white
mainPolyline.strokeWidth = 2
mainPolyline.zIndex = 10
mainPolyline.map = mapView
然后添加具有相同路径的另一条折线,修改原始文件的strokeWidth和zIndex:
let lowerPolyLine = GMSPolyline(path: samePathAsYourMainPolyline)
lowerPolyLine.strokeWidth = mainPolyline.strokeWidth + 1
lowerPolyLine.strokeColor = UIColor.black
lowerPolyLine.zIndex = mainPolyline.zIndex - 1
lowerPolyLine.map = mapView;
如果您使用的是地图套件,那么here是可以完全自定义的库。
希望这会有所帮助。