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