开发者

Location Specification with an iOS MapView

Using an iOS device, I am interested in tapping a mapview and getting back the lat / long coordinates of that spot. Is this pos开发者_C百科sible?


You can get the CLLocationCoordinate2D using convertPoint:toCoordinateFromView method of the MKMapView.

CLLocationCoordinate2D coordinate = [self.mapView convertPoint:[gesture locationInView:self.mapView] toCoordinateFromView:self.mapView];

I put this in a tap gesture handler to work. But if you are using some other mechanism to get the touch point, you can use the touch point as the argument passed in convertPoint:.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜