iphone:ubercab又名(超级)地图坐标 [英] iphone: ubercab aka (uber) map coordinate

查看:285
本文介绍了iphone:ubercab又名(超级)地图坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能描述如何通过它在屏幕中心的位置来获取MKMapView的地图坐标吗?查看优步应用程序(免费)。它们有一个静态位于屏幕中间的引脚,您可以拖动地图,但引脚会停留在那里。屏幕中间是他们找到你的位置(非常非常快),显示你接近的地址。

Can anyone describe how to get the map coordinate of a MKMapView by its position on center of screen? Check out Uber app (its free). They have a pin statically located in the middle of the screen and you drag the map but the pin stays there. The middle of the screen is they find your location (very very quickly) showing you the address you are close to.

推荐答案

Heyo !我是优步的移动工程师(你要求我提供一些Uber的帮助:))诀窍是将地址(实际上是UIImage)放在地图的中心。引脚位于地图的顶部,不是注释。然后,每当你得到regionDidChangeAnimated回调时,你就可以得到地图中心的坐标:

Heyo! I'm the mobile Engineer at Uber (you asked for some Uber help I assume :)) The trick is to place the pin, which is actually a UIImage, at the center of the map. The pin is on top of the map and is not an annotation. Then, whenever you get the regionDidChangeAnimated callback, you get the coordinate of the center of the map using this:

CLLocationCoordinate2D center = m_mapView.centerCoordinate;
CLLocation *location = [[[CLLocation alloc] initWithLatitude:center.latitude longitude:center.longitude] autorelease];

理想情况下,您希望引脚的底部准确指向地图视图的中心。

Ideally, you want the bottom part of the pin to point exactly at the center of the map view.

希望这会有所帮助,
Jordan

Hope this helps, Jordan

这篇关于iphone:ubercab又名(超级)地图坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆