I have some annotations presented on a map (somepoints) the map zooms in or out to fit all points - see working code below.
MKPolygon *poly = [MKPolygon polygonWithPoints:somepoints count:i];
[self.mapView setRegion:MKCoordinateRegionForMapRect([poly boundingMapRect]) animated:NO];
Q: I would like to expand this poly just slightly to have some margins, how can I enlarge this Region?
setRegion
(which requires converting theMKMapRect
toMKCoordinateRegion
). You can usesetVisibleMapRect
directly and apply padding:[self.mapView setVisibleMapRect:poly.boundingMapRect edgePadding:UIEdgeInsetsMake(100, 100, 100, 100) animated:NO];
– Interval