How to change default camera behavior when marker

2019-05-18 14:45发布

In release 1.2 of the Google Maps for iOS SDK the default behavior of a tapped marker changed. The release note says: "The default behavior when a marker is tapped has been updated to also pan the camera to the marker's position"

How can I get the old behavior back, i.e. not panning the camera center to the position of the marker?

2条回答
Fickle 薄情
2楼-- · 2019-05-18 15:24

you can use this:

mapView.selectedMarker = nil

func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
        mapView.selectedMarker = nil
        return true
}
查看更多
趁早两清
3楼-- · 2019-05-18 15:34

Add the following method to your GMSMapView delegate implementation. GMSMapView will no longer center on the selected marker and brings back the existing behavior.

- (BOOL) mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
     mapView.selectedMarker = marker;
     return TRUE;
}
查看更多
登录 后发表回答