1
我正在寻找从uimapkit获取经纬度的答案。有同样的问题已被回答,但它没有给出正确的坐标。 http://yit.me/3ddp73如何在MapKit for iPad中获取左上角和右下角的地图纬度和经度?
它是我上面链接的代码。
CLLocationCoordinate2D topLeft, bottomRight;
topLeft = [mapView convertPoint:CGPointMake(0,0) toCoordinateFromView:mapView];
CGPoint pointBottomRight = CGPointMake(mapView.frame.size.width, mapView.frame.size.height);
bottomRight = [mapView convertPoint:pointBottomRight toCoordinateFromView:mapView];
NSLog(@"topleft = %f", topLeft);
NSLog(@"bottom right = %f", bottomRight);
有什么想法解决这个问题?
感谢
对不起,但它给了我“错误:无效初始值设定项”。 你能解释为什么你使用CLLocationCoordinate2DMake不是简单的CGPoint? 谢谢 – damniatx 2010-06-06 22:05:46
@dam:您需要导入CoreLocation。 – kennytm 2010-06-06 22:22:07
没有解决错误。 -_- – damniatx 2010-06-06 22:30:32