var search: AMapSearchAPI!//搜索
search = AMapSearchAPI()
search.delegate = self
let request = AMapReGeocodeSearchRequest()
request.location = AMapGeoPoint.location(withLatitude: CGFloat(gdMapView.centerCoordinate.latitude), longitude: CGFloat(gdMapView.centerCoordinate.longitude))
search.aMapReGoecodeSearch(request)
func onReGeocodeSearchDone(_ request: AMapReGeocodeSearchRequest!, response: AMapReGeocodeSearchResponse!) {
if response.regeocode == nil {
return
//解析response返回数据
let pc = response.regeocode.addressComponent.province + response.regeocode.addressComponent.city
let address = response.regeocode.formattedAddress.substringFrom(pc.length())
print("response返回\(address)")
print("response返回\(pc)")
}
}