美文网首页
swift 集成高德地图完场poi搜索数据

swift 集成高德地图完场poi搜索数据

作者: i得深刻方得S | 来源:发表于2016-09-19 13:37 被阅读120次

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

相关文章

网友评论

      本文标题:swift 集成高德地图完场poi搜索数据

      本文链接:https://www.haomeiwen.com/subject/wjqnettx.html