相关疑难解决方法(0)

如何在MapKit中获取地图的左上角和右下角经度

如何在MapKit中获取地图的左上角和右下角经度?我使用此代码,但它无法正常工作.我该如何解决?

MKCoordinateRegion region = [map region];

double topL,topG,bottomL,bottomG;
//if latitude=55 and latitudeDelta=126 topL is 118 and it will be not at top, it will be at buttom of screen
topL = region.center.latitude + region.span.latitudeDelta/2; 

topG = region.center.longitude - region.span.longitudeDelta/2;

CLLocationCoordinate2D lt;
lt.latitude=topL;
lt.longitude=topG;
annotation = [Annotation new];
annotation.coordinate = lt;
annotation.title = @"Left";
[map addAnnotation:annotation];
[annotation release];
//if latitude=55 and latitudeDelta=126 bottomL is -7.23 and it will be not at bottom, it will be at above bottom of screen
bottomL …
Run Code Online (Sandbox Code Playgroud)

iphone mapkit

11
推荐指数
2
解决办法
6415
查看次数

标签 统计

iphone ×1

mapkit ×1