Search code examples
google-maps-sdk-ios

Setting Maximum Zoom Level kGMSMaxZoomLevel for Google Maps for iOS SDK


I am trying out the iOS Google Maps SDK and notice in GMSCameraPosition.h header file there is reference to kGMSMaxZoomLevel to set the maximum zoom level allowed. I'd like to be able to set this but when #defining a value for that in the implementation, XCode states that there are duplicate symbols when doing so, so won't compile. Can someone point me in the right direction for setting the Minimum and Maximum zoom levels using this new SDK? Many thanks


Solution

  • The kGMSMaxZoomLevel is the maximum value which the SDK supports, ie which you can set when creating a GMSCameraPosition. You can't change its value, to make maps stop at a different zoom level.

    You could maybe try listening for [mapView:didChangeCameraPosition:], and then if the camera position is more zoomed in than you'd like, move it back out again. I haven't tried this, so I'm not sure if it would work. It might stutter a bit - ie the user will zoom a bit past the max, you'll set it back, then the user will zoom a bit past again, and so on.