gpt4 book ai didi

ios - 定位 GMSMapView 以一次显示多个注释

转载 作者:可可西里 更新时间:2023-11-01 03:38:46 25 4
gpt4 key购买 nike

我的问题与 this, except MKMapView. 非常相似我怎样才能用谷歌地图做同样的过程(调整 map 大小以适应屏幕上的所有注释/标记)?据我了解,我必须将 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];
}

关于ios - 定位 GMSMapView 以一次显示多个注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15645323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com