开发者

Get MapKit view border coordinates

开发者 https://www.devze.com 2023-03-08 00:05 出处:网络
how can I get the MapKit view bounds开发者_如何学C coordinates for example I need to get the north-east bound coords and the south-west bound coords.

how can I get the MapKit view bounds开发者_如何学C coordinates for example I need to get the north-east bound coords and the south-west bound coords.

Thanks.


MKCoordinateRegion region = mapView.region;

minLat = region.center.latitude - (region.span.latitudeDelta / 2.0);
maxLat = region.center.latitude + (region.span.latitudeDelta / 2.0);

minLong = region.center.longitude - (region.span.longitudeDelta / 2.0);
maxLong = region.center.longitude + (region.span.longitudeDelta / 2.0);

Northeast coords are (maxLat, maxLong) and southwest coords are (minLat, minLong).

0

精彩评论

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

关注公众号