开发者

get current map extent

How can i get the current map extent, I.E the min x,y and max x,y for开发者_运维问答 my current region in my mapview?

Okay- The below works now.

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;


[mkMapViewObject region] returns an MKCoordinateRegion that contains a center point and a lat/long span for what is being displayed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜