我的问题与此非常相似,除了MKMapView. 如何使用Google地图执行相同的过程(调整地图大小以适应屏幕上的所有注释/标记)?据我所知,我必须将MKCoordinateRegion转换为GMSProjection,我的方法是对的吗?
kok*_*uke 13
这很简单,只是:
@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];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3610 次 |
| 最近记录: |