Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在tableview单元格中加载google地图多段线视图?_Ios_Google Maps_Uitableview_Swift3 - Fatal编程技术网

Ios 如何在tableview单元格中加载google地图多段线视图?

Ios 如何在tableview单元格中加载google地图多段线视图?,ios,google-maps,uitableview,swift3,Ios,Google Maps,Uitableview,Swift3,我正在使用谷歌的方向api来获取所有的路线信息。从响应中,我将“overview_polyline”的值传递给GMSPath对象。不幸的是,它没有显示地图。我在上一个屏幕中应用了相同的逻辑,并完美地加载了多段线。我的单元格是否在映射加载之前初始化 let camera = GMSCameraPosition.camera(withLatitude: searchLocation.coordinate.latitude,

我正在使用谷歌的方向api来获取所有的路线信息。从响应中,我将“overview_polyline”的值传递给GMSPath对象。不幸的是,它没有显示地图。我在上一个屏幕中应用了相同的逻辑,并完美地加载了多段线。我的单元格是否在映射加载之前初始化

        let camera = GMSCameraPosition.camera(withLatitude: searchLocation.coordinate.latitude,
                                              longitude: searchLocation.coordinate.longitude, zoom: 8)
        let mapView = GMSMapView.map(withFrame: cell.viaMap.frame, camera: camera)

         let center = CLLocationCoordinate2D(latitude: MomentaryLatitude, longitude: MomentaryLongitude)

        mapView.isMyLocationEnabled = true

        cell.viaMap.addSubview(mapView)

        let marker = GMSMarker()

        marker.title = "Current Location"
        marker.snippet = "XXX"
        marker.map = cell.viaMap

        let path: GMSPath = GMSPath(fromEncodedPath: myPolyLine)!
        let routePolyline = GMSPolyline(path: path)
        routePolyline.map = cell.viaMap


        routePolyline.strokeWidth = 50
        routePolyline.strokeColor = UIColor.red
        routePolyline.map = cell.viaMap

        var bounds = GMSCoordinateBounds()

        let pathInt = Int((path.count()))

        for i in 0  ..< pathInt{
            bounds = bounds.includingCoordinate(path.coordinate(at: UInt(i)))
        }




        cell.viaMap.animate(with: GMSCameraUpdate.fit(bounds))
let camera=GMSCameraPosition.camera(带纬度:searchLocation.coordinate.latitude,
经度:searchLocation.coordinate.longitude,缩放:8)
设mapView=GMSMapView.map(带边框:cell.viaMap.frame,摄像头:摄像头)
让中心=CLLocationCoordinate2D(纬度:瞬时性,经度:瞬时性)
mapView.isMyLocationEnabled=true
cell.viaMap.addSubview(mapView)
let marker=GMSMarker()
marker.title=“当前位置”
marker.snippet=“XXX”
marker.map=cell.viaMap
让路径:GMSPath=GMSPath(fromEncodedPath:myPolyLine)!
让routePolyline=GMSPolyline(路径:path)
routePolyline.map=cell.viaMap
routePolyline.strokeWidth=50
routePolyline.strokeColor=UIColor.red
routePolyline.map=cell.viaMap
var bounds=GMSCoordinateBounds()
让pathInt=Int((path.count()))
对于0中的i..
你有什么解决办法吗?有。我有办法我也有办法。无论如何,谢谢!这真的应该用谷歌目录api来标记吗?