MKCoordinateRegionMake
緯度と経度の最高値と最低値がわかっている場合は、代わりに を使用して、少なくとも少し単純化できますMKCoordinateRegionMakeWithDistance
。おそらく次のようなものです:
CLLocationDegrees highestLatitude;
CLLocationDegrees lowestLatitude;
CLLocationDegrees highestLongitude;
CLLocationDegrees lowestLongitude;
// Calculate the above variable values...
// These calculations would have to be more complex if you need to handle the fact that longitude values wrap
CLLocationDegrees latitudeDelta = highestLatitude - lowestLatitude;
CLLocationDegrees longitudeDelta = highestLongitude - lowestLongitude;
CLLocationCoordinate2D center = CLLocationCoordinate2DMake(lowestLatitude + (latitudeDelta / 2.0f), lowestLongitude + (longitudeDelta / 2.0f));
MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta);
MKCoordinateRegionMake(center, span);