如何在MapKit For iPad中获取地图的左上角和右下经纬度?
我正在寻找有关从 uimapkit 获取纬度和经度的答案。已经回答了同样的问题,但没有给出正确的坐标。 http://yit.me/3ddp73
这是我上面链接的线程中的代码。
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);
有办法解决这个问题吗?
谢谢
i'm looking for answer about getting latitude and longitude from uimapkit. there is same problem that has been answered, but it didn't give right coordinate. http://yit.me/3ddp73
it's code from thread i'm linking above.
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);
any idea to fix this issue ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
地图视图有一个
region
属性。该区域包含中心和二维跨度,等等
。
The map view has a
region
property.the region contains the center and the 2D span, so
etc.
原解很接近。视图的坐标系的原点位于左下角。因此 CGPoint(0,0) 实际上是左下角,而不是顶部。另一个坐标将是您的右上角。
The original solution is close. The view's coordinate system has the origin at the bottom left. Therefore CGPoint(0,0) is actually bottom left, not top. And the other coordinate will be your top right.