I want to be able to zoom my MKMapView to fit it's annotations. I have managed to do it using iOS7's showAnnotations
method. But I would also like to add some padding or inset from the map view border. This is because I have a semi-transperant view that overlays the top part of my map, and I don't want annotations to be places behind this view. I have tried this:
[self.mapView showAnnotations:annotations animated:YES];
[self.mapView setVisibleMapRect:self.mapView.visibleMapRect edgePadding:UIEdgeInsetsMake(100, 20, 10, 10) animated:NO];
But it's not working as I would have hoped. Any ideas on how I could do it differently?
You could also simply use
[self.mapView showAnnotations:annotations animated:YES];
self.mapView.camera.altitude *= 1.4;
to zoom out a little. Works well for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With