How to get current zoom level from google map for ios? How to get current zoom level from google map for ios? ios ios

How to get current zoom level from google map for ios?


OK, I find solution,get current zoom:

CGFloat currentZoom = self.MapView.camera.zoom;

and then use it in camera:

camera = [GMSCameraPosition cameraWithLatitude:locationManager.location.coordinate.latitude                                     longitude:locationManager.location.coordinate.longitude                                          zoom:currentZoom];self.MapView.camera = camera;


If you want to detect Zoom level while user is interacting with map.We can use Google Map delegate Method

func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) {    let zoom = mapView.camera.zoom    print("map zoom is ",String(zoom))}

Dont forgot to add GMSMapViewDelegate


my two cents for swift 4.x:

let currZoom = self.googleMapView.camera.zoom

BUT is a Float, NOT a CGFloat, as in first objC sample.In Swift a Float is NOT a CGFloat.


matomo