How to fit all visible objects/bounds on maps (Google Map iOS SDK 1.4)

555 Views Asked by At

Following code work well in Google Maps iOS SDK 1.8 but getting error in version 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];

but I have to downgrade my Google Maps iOS SDK version to 1.4 to support iOS 5.1 and facing error with following line of code, Seems cameraForBounds function not available in older version.

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

So anybody can suggest alternative of that?

1

There are 1 best solutions below

0
Rizwan Javed On BEST ANSWER

I solved above problem myself. Below line of code did the magic, in case anybody else facing the same issue.

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