有没有办法获取触摸位置的MKMapView的较长时间-iPhone SDK [英] Is there any way to get the lat long of MKMapView of touch position - iPhone SDK
问题描述
如何获取地图视图上触摸位置的纬度和经度?
How to get the latitude and longitude of touch position on map view?
我想在用户触摸时像Google的javascript API一样固定一个针脚.
I want to drop a pin where user touches just like google's javascript API does.
iphone SDK中有可能吗?教程将对您有很大的帮助.
Is it possible in iphone SDK? Tutorial would be a great help.
推荐答案
MKMapView
has a method, - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view that can be used to get the longitude and latitude that any specified point would fall on.
要获得触摸位置,如果可以将自己限制为iOS 3.2及更高版本,到目前为止,最简单的方法是添加
To get the touch position, if you're fine with limiting yourself to iOS 3.2 and above, by far the easiest thing to do is to add a UITapGestureRecognizer to the relevant MKMapView.
这篇关于有没有办法获取触摸位置的MKMapView的较长时间-iPhone SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!