Сначала вам нужно найти начальный регион карты. Скажем, ваша карта называется mapView ... вы можете сначала найти это по (в вашем viewDidLoad):
CLLocationCoordinate2D center = mapView.centerCoordinate;
CLLocationDegrees lat = center.latitude;
CLLocationDegrees lon = center.longitude;
MKCoordinateRegion region = mapView.region;
MKCoordinateSpan span = region.span;
//Assuming they have been declared as instance variables of type double
current_lat_low = lat - span.latitudeDelta / 2.0;
current_lat_high = lat + span.latitudeDelta / 2.0;
current_lon_low = lon - span.longitudeDelta / 2.0;
current_lon_high = lon + span.longitudeDelta / 2.0;
Это даст вам начальную область показанной карты. Тогда в
- (void)mapView:(MKMapView*)mapView regionDidChangeAnimated:(BOOL)animated
{
CLLocationCoordinate2D center = mapView.centerCoordinate;
CLLocationDegrees lat = center.latitude;
CLLocationDegrees lon = center.longitude;
MKCoordinateRegion region = mapView.region;
MKCoordinateSpan span = region.span;
double lat_low = lat - span.latitudeDelta / 2.0;
double lat_high = lat + span.latitudeDelta / 2.0;
double lon_low = lon - span.longitudeDelta / 2.0;
double lon_high = lon + span.longitudeDelta / 2.0;
//do any work comparing the initial lat/lons with the new values
.....
//set current lat/lon to be the new lat/lon after work is complete
current_lat_low = lat_low;
current_lat_high = lat_high;
current_lon_low = lon_low;
current_lon_high = lon_high;
}