iOS 根据经纬度翻译成详细位置的各种方法(2)
调用的话就是这样
jsonString = [NSString stringWithFormat:SEARCH_GOOGLE,location.coordinate.latitude,location.coordinate.longitude,@"food"];
jsonString = [NSString stringWithFormat:SEARCH_GOOGLE,location.coordinate.latitude,location.coordinate.longitude,@"bus_station"];
jsonString = [NSString stringWithFormat:SEARCH_GOOGLE,location.coordinate.latitude,location.coordinate.longitude,@"hospital"];
PS2:有个功能,如果长时间按住地图上某个地方,如何获取其经纬度,进而对其显示位置呢?
----
[plain]
//开始点击长按,不然会执行2次。
if (sender.state==UIGestureRecognizerStateBegan) {
//isLongPress=YES;
CGPoint touchPoint=[sender locationInView:self.myMapView];
CLLocationCoordinate2D touchCoordinate=[self.myMapView convertPoint:touchPoint toCoordinateFromView:self.myMapView];//将触摸点转换经纬度
//反向解析长按时的大头针的信息
location =[[CLLocation alloc]initWithLatitude:touchCoordinate.latitude longitude:touchCoordinate.longitude];
相关新闻>>
- 发表评论
-
- 最新评论 更多>>