美文网首页
高德(AMap)地图Swift2.0

高德(AMap)地图Swift2.0

作者: iOS_我更专业 | 来源:发表于2018-01-18 20:13 被阅读0次

Swift2.0接入高德地图(AMap):

    一、去官网下载SDK;

    二、在Swift的Header文件中声明:

    

头文件

    三、Info.plist设置

这里只填写了‘当使用时才开启的’配置

    四、在AppDelegate.swift中初始化:

        AMapServices.sharedServices().apiKey = "***"

地图的一些设置 地图的一些设置

五、具体类

    1、POI搜索请求基类 AMapPOIKeywordsSearchRequest,其中Type、City、cityLimit等都可以设置;搜索反馈的回掉为:

    func onPOISearchDone(_ request: AMapPOISearchBaseRequest!, response: AMapPOISearchResponse!) {}

      2、//大头针拖拽时的方法

    func mapView(mapView: MAMapView!, annotationView view: MAAnnotationView!, didChangeDragState newState: MAAnnotationViewDragState, fromOldState oldState: MAAnnotationViewDragState) {}

       3、//实时获取地理位置

    func mapView(mapView: MAMapView!, didUpdateUserLocation userLocation: MAUserLocation!, updatingLocation: Bool) {}

       4、//初始化逆地理编码->已知的经纬度获取对应信息等。如街道地址

    func initReRequest(latitude : CGFloat ,longitude : CGFloat){}

        5、 //逆地理编码回调函数

    func onReGeocodeSearchDone(request: AMapReGeocodeSearchRequest!, response: AMapReGeocodeSearchResponse!) {}

相关文章

网友评论

      本文标题:高德(AMap)地图Swift2.0

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