Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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 |点击标记可缩小谷歌地图SDK_Ios_Swift_Xcode_Google Maps_Swift4 - Fatal编程技术网

iOS |点击标记可缩小谷歌地图SDK

iOS |点击标记可缩小谷歌地图SDK,ios,swift,xcode,google-maps,swift4,Ios,Swift,Xcode,Google Maps,Swift4,我有一个GMSMapView实例,orderMapView,它链接到我的UIViewController。我授予位置权限,然后将自己作为orderMapView orderMapView.delegate = self 我还使类符合GMSMapViewDelegate。然后在viewDidLoad中启动多个标记,其中一个如下所示: let marker = GMSMarker() marker.position = CLLocationCoordinate2D(latitude: CLLoca

我有一个
GMSMapView
实例,
orderMapView
,它链接到我的
UIViewController
。我授予位置权限,然后将自己作为
orderMapView

orderMapView.delegate = self
我还使类符合
GMSMapViewDelegate
。然后在
viewDidLoad
中启动多个标记,其中一个如下所示:

let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: CLLocationDegrees(dataLat), longitude: CLLocationDegrees(dataLng))
marker.title = dataName
marker.snippet = "LAT: \(dataLat), LONG: \(dataLng)"
marker.appearAnimation = .pop
marker.map = orderMapView
marker.isDraggable = true
marker.isTappable = true
我还实现了以下委托方法:

func mapView(_ mapView: GMSMapView, didTapAt coordinate: CLLocationCoordinate2D){
//1 - IT NEITHER COMES HERE
    print(coordinate)
}

func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
    print(position)
}


func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
//2 - IT NEITHER COMES HERE
    orderMapView.selectedMarker = marker
    return true
}

func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
    let view = UIView(frame: CGRect.init(x: 0, y: 0, width: 200, height: 70))
    view.backgroundColor = UIColor.white
    view.layer.cornerRadius = 6

    let lbl1 = UILabel(frame: CGRect.init(x: 8, y: 8, width: view.frame.size.width - 16, height: 15))
    lbl1.text = marker.title
    view.addSubview(lbl1)

    let lbl2 = UILabel(frame: CGRect.init(x: lbl1.frame.origin.x, y: lbl1.frame.origin.y + lbl1.frame.size.height + 3, width: view.frame.size.width - 16, height: 15))
    lbl2.text = marker.snippet
    lbl2.font = UIFont.systemFont(ofSize: 14, weight: .light)
    view.addSubview(lbl2)

    return view
}
我可以看到地图上的标记,但当我点击它时,地图会缩小,并且不会显示这些标记上的信息窗口。请帮忙

更新:这是在模拟器上发生的,因为我没有设备。这是唯一的问题吗