问题描述
我目前正在迅速构建一个iOS应用.我在自己的一个ViewController中放置了一个GMSMapView,并在屏幕中间放置了一个标记.标记永远不会移动.
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.
当我缩放或缩放时,标记位置会改变,与标记关联的地址也会改变.我希望能够缩放与Uber应用上相同的精确位置.
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.
我已经阅读了关于stackoverflow的一些答案,例如: Google Maps Center在缩放时,但没有一个起作用.
I've read some of the answers on stackoverflow like this one : Google Maps Center while zooming but none of them worked.
是否可以直接使用Google Maps SDK执行此操作,还是应该编写一种算法来保存最近的已知位置并放大该位置?
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 ?
推荐答案
如果我正确理解,您是否希望在屏幕中间居中,然后进行放大和缩小,但没有mapview滚动?
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地图确实具有此功能.为了防止地图视图滚动,请为您的地图视图实现allowScrollGesturesDuringRotateOrZoom = false
Google maps does have this feature. To prevent the mapview from scrolling, implement allowScrollGesturesDuringRotateOrZoom = false for your mapview.settings:
myMapView.settings.allowScrollGesturesDuringRotateOrZoom = false
这篇关于放大屏幕中心-Google Maps iOS SDK Swift的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!