定位GMSMapView一次显示多个注释

我的问题是非常相似的,除了MKMapView。 如何使用Google地图执行相同的过程(调整地图的大小,使其一次适合屏幕上的所有注释/标记)? 据我所知,我必须将MKCoordinateRegion转换为GMSProjection,是我的方式吗?

这很简单,只是:

@property (nonatomic, strong) GMSMapView *mapView; - (void)didTapFitBoundsWithMarkers:(NSArray *)markers { GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] init];; for (GMSMarker *marker in markers) { bounds = [bounds includingCoordinate:marker.position]; } GMSCameraUpdate *update = [GMSCameraUpdate fitBounds:bounds]; [self.mapView moveCamera:update]; [self.mapView animateToViewingAngle:50]; }