2014-09-04 53 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]];