我有一个ios应用程序,我在谷歌地图缩放到一定的缩放水平编程,但当我这样做地图改变其中心。我希望能够在保持当前中心为中心的情况下放大。有谁能帮帮我吗?
下面的代码:GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:18.5600
longitude:73.7903
zoom:12];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
mapView_.userInteractionEnabled =YES;
mapView_.delegate = self;
mapView_.settings.myLocationButton = YES;
mapView_.settings.compassButton = YES;
mapView_.padding = UIEdgeInsetsMake(20, 0, 20, 0);
mapView_.mapType = kGMSTypeHybrid;
self.view = mapView_;
我是这样添加地图的。
在特定情况下,我将其缩放到14:
camera=[GMSCameraPosition cameraWithLatitude:lat longitude:lon zoom:14];
[mapView_ setCamera:camera];
这是一个迟来的回答,但希望能帮助到将来遇到类似问题的人。
您应该将GMSMapView
对象的settings
的allowScrollGesturesDuringRotateOrZoom
设置为false
。当你缩放或旋转时,这将禁用GMSMapView上的任何其他手势。
settings
这里是GMSUISettings
类,负责地图的所有用户界面设置。
mapView.settings.allowScrollGesturesDuringRotateOrZoom = false