【发布时间】:2013-03-26 19:03:55
【问题描述】:
我的问题与this, except MKMapView. 非常相似 如何使用 Google 地图执行相同的过程(调整地图大小以一次适应屏幕上的所有注释/标记)? 据我了解,我必须将 MKCoordinateRegion 转换为 GMSProjection,我的方法对吗?
【问题讨论】:
标签: ios google-maps
我的问题与this, except MKMapView. 非常相似 如何使用 Google 地图执行相同的过程(调整地图大小以一次适应屏幕上的所有注释/标记)? 据我了解,我必须将 MKCoordinateRegion 转换为 GMSProjection,我的方法对吗?
【问题讨论】:
标签: ios google-maps
很简单,就是:
@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];
}
【讨论】:
includingCoordinate)。而且 API 不包含 GMSCameraUpdate 类