2015-08-26 116 views
1

我有一个ios应用程序,我在谷歌地图上以编程方式放大某个缩放级别,但是当我这样做时,地图更改了它的中心。我希望能够以当前中心为中心进行放大。 任何人都可以帮助我。下面谷歌地图更改中心时放大ios sdk

代码:

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]; 
+0

您可能需要提供一些代码才能确定问题。 –

+0

@PCLuddite代码添加。 – Nilesh

回答

0

这是一个迟到的回答,但希望帮助别人,在今后发生类似的问题。

您应该将对象的settings设置为allowScrollGesturesDuringRotateOrZoomfalse。当您缩放或旋转时,这将禁用GMSMapView上的任何其他手势。

settings这是GMSUISettings类,它负责地图的所有用户界面设置。

mapView.settings.allowScrollGesturesDuringRotateOrZoom = false