2010-12-13 37 views
0

Comment puis-je obtenir l'étendue actuelle de la carte, I.E le min x, y et max x, y pour ma région actuelle dans ma vue cartographique?obtenir l'étendue actuelle de la carte

Bon - Le fonctionnement ci-dessous fonctionne maintenant.

MKCoordinateRegion region=map.region; 
MKCoordinateSpan span=map.region.span; 

CLLocationCoordinate2D center=region.center; 
float lat=center.latitude; 
float lon=center.longitude; 

float spanLat=span.latitudeDelta/2; 
float spanLon=span.longitudeDelta/2; 

NSLog(@"Center Lat: %f",lat); 
NSLog(@"Center Lon: %f",lon); 
NSLog(@"span Lat: %f",spanLat); 
NSLog(@"span Lon: %f",spanLon); 

float minLat=lat-spanLat; 
float minLon=lon-spanLon; 
float maxLat=lat+spanLat; 
float maxLon=lon+spanLon; 

Répondre

0

[mkMapViewObject region] retourne un MKCoordinateRegion qui contient un point central et une durée lat/long pour ce qui est affiché.