在我的iOS应用程序中,我使用的是GoogleMaps和用于地图的app,但我对它并不是很熟悉。
我知道,使用iOS原生MKMapView,您可以设置一个可见的地图矩形,以适合所需的适当缩放级别的所有点,如下所述:Zooming MKMapView to fit annotation pins?
但我不确定如何为GMSMapView做这样的事情。有人知道怎么做吗?
任何形式的帮助都是非常感谢的!
发布于 2021-07-24 06:46:06
在地图上设置标记后添加以下内容:
var bounds = GMSCoordinateBounds()
for coordinate in testCoordinates
{
bounds = bounds.includingCoordinate(coordinate)
}
let update = GMSCameraUpdate.fit(bounds, withPadding: 50)
mapView.animate(with: update)
https://stackoverflow.com/questions/68503946
复制相似问题