2014-09-04 48 views
1

下面的代码工作,以及在谷歌地图iOS版SDK 1.8,但得到的错误版本1.4如何适应在地图上的所有可见对象/界限(谷歌地图iOS版SDK 1.4)

[mapView animateWithCameraUpdate:[GMSCameraUpdate fitBounds:bounds3]]; 
camera=[mapView cameraForBounds:bounds3 insets:UIEdgeInsetsZero]; 

CLLocationCoordinate2D mapCenter = camera.target; 
camera = [GMSCameraPosition cameraWithLatitude:mapCenter.latitude 
            longitude:mapCenter.longitude 
              zoom:camera.zoom]; 

,但我不得不降级我的谷歌将iOS SDK版本映射到1.4以支持iOS 5.1并面对以下代码行出现错误,看起来cameraForBounds功能在旧版本中不可用。

camera=[mapView cameraForBounds:bounds3 insets:UIEdgeInsetsZero]; 

那么任何人都可以建议替代吗?

回答

0

我自己解决了上面的问题。下面的代码行使了魔法,以防其他人面临同样的问题。

[mapView animateWithCameraUpdate:[GMSCameraUpdate fitBounds:bound3 withPadding:20.0f]];