1.类实现协议AMapSearchDelegate
var mapView = MAMapView()
var search = AMapSearchAPI()
let tips = AMapInputTipsSearchRequest()
tips.keywords=textView.text
tips.city="合肥"
2.发起poi搜索
self.search.AMapInputTipsSearch(tips)
3.实现协议回调
func onInputTipsSearchDone(request: AMapInputTipsSearchRequest!, response: AMapInputTipsSearchResponse!) {
arrData.setArray(response.tips)
//刷新表数据
tableView .reloadData()
}
4 自定义cell
let cell = tableView .dequeueReusableCellWithIdentifier("cellID", forIndexPath: indexPath) as! SGDetailAddressViewCell
let point: AMapTip = arrData[indexPath.row] as! AMapTip
cell.titLab.text=point.name
cell.addressLab.text=point.district
cell.selectedBackgroundView=UIView.init(frame: cell.frame)
cell.selectedBackgroundView?.backgroundColor=RGB(216, g: 216, b: 216)
return cell