我正在添加我的 map View
mapView_ = [[GMSMapView alloc]initWithFrame:_viewMapContainer.bounds];
mapView_.myLocationEnabled = YES;
mapView_.frame = _viewMapContainer.bounds;
[_viewMapContainer addSubview: mapView_];
在我的应用程序中,此 View 仅用于显示整个世界地图和一些标记。我无法在一个 View 中显示整个世界。任何帮助都将不胜感激,我不希望用户在上面进行交互
最佳答案
我也遇到过这个问题
- (void)focusMapToShowAllMarkers
{
CLLocationCoordinate2D myLocation = ((GMSMarker *)_markers.firstObject).position;
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:myLocation coordinate:myLocation];
for (GMSMarker *marker in _markers)
bounds = [bounds includingCoordinate:marker.position];
[_mapView animateWithCameraUpdate:[GMSCameraUpdate fitBounds:bounds withPadding:15.0f]];
}
请试试这个并分享响应。
快乐编码:)
关于ios - GMSMapView 显示整个世界地图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32884983/