定位GMSMapView以一次显示多个注释 [英] Positioning GMSMapView to show multiple annotations at once
本文介绍了定位GMSMapView以一次显示多个注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
My question is quite similar to this, except MKMapView. How can I do the same process(resize the map to fit all annotations/markers on screen at once) with Google Maps? As I understand I have to convert MKCoordinateRegion to GMSProjection, is my way right?
推荐答案
:
Thats very simple, just:
@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];
}
这篇关于定位GMSMapView以一次显示多个注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文