I am currently building an iOS app in swift. I put a GMSMapView inside one of my ViewControllers and I put a marker in the middle of the screen. The marker never moves.
When I zoom or unzoom, the marker position changes and so does the address associated to the marker. I want to be able to zoom on the same exact position as it is done on the Uber app.
I've read some of the answers on stackoverflow like this one : Google Maps Center while zooming but none of them worked.
Is there a way to do this directly with the Google maps SDK or should I write an algorithm that saves the last known position and zooms on this position ?
If I understand correctly, you are looking to centre in the middle of the screen, then zoom in and out, but not have the mapview scroll?
Google maps does have this feature. To prevent the mapview from scrolling, implement allowScrollGesturesDuringRotateOrZoom = false for your mapview.settings:
myMapView.settings.allowScrollGesturesDuringRotateOrZoom = false
https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_u_i_settings.html#a4c1156d319c0724284062167e47decc4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With