首页 > 编程知识 正文

高德地图批量标注地点,高德地图采集

时间:2023-05-05 02:21:33 阅读:44922 作者:2471

黄金地图api自定义尺寸点重复点击问题

1 .使用黄金地图api后,您可以访问它以创建地图,然后将地图添加到可见区域

-(void ) createMAMapView{

self.mapview=[ mamapviewalloc ] init; self.mapview.autoresizingmask=uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight; self.mapView.delegate=self; //普通风格[ self.mapviewsetzoomlevel :14 animated : yes ] self.mapview.maptype=mamaptypestandard; self.mapView.scrollEnabled=YES; //平移是否支持self.mapView.zoomEnabled=YES; self.mapView.showsCompass=NO; //隐藏指南针self.mapview.showsuserlocation=yes; self.mapview.usertrackingmode=mausertrackingmodefollow; //[ self.viewaddsubview 3360 self.map vie [ self.mapview MAS _ make constraints 3360 ^ (masconstraintmaker * make ) make.] make.top.MAS_equalto(0; make.Bottom.MAS_equalto(0; (); 2 .根据获取的数据,初始化标记点。 初始化时,必须首先删除地图上的现有标记点

[ self.mapviewremoveannotations 3360 self.annotations ]

根据数据中的纬度和经度添加这些标记点

for(intI=0; i self.mutableArray.count; I )

{ mapointannotation * point=[ mapointannotationalloc ] init; redenvelopmodel * curent model=self.mutable array [ I ]; point.coordinate=cllocationcoordinate 2d make ([ curent model.latdoublevalue ]、[curentModel.lng doubleValue] ); [ self.annotations addobject : point ] }3.然后,在地图上展示这些标记点

[ self.mapviewaddannotations : self.annotations ]

[ self.mapviewshowannotations 3360 self.annotations animated :是]

4 .调用在地图上点击标记点的代理时,发现在黄金地图上选择标记点时往往不能反复点击问题,按照网上的描述还是会出现问题,所以选择标记点的代理

(void ) mapview: ) mamapview* ) mapviewdidselectannotationview : (mannotationview * ) view; 用中等详细方法调用5。 我们将CustomAnnotationView继承到MAAnnotationView,并将按钮添加到CustomAnnotationView,并使用按钮的单击事件替换地图标记点的单击事件

6 )在生成标记视图的代理方法中,可以这样写

(MAAnnotationView * ) mapview:(mamapview* ) mapviewviewforannotation : (id ) annotation ) if ([ annotationioniskiondiondion

返回倪; } else if (annotationiskindofclass : [ mapointannotationclass ] (staticnsstring * customreuseindetifier=@“custom mier”)

客户维护视图*维护视图=(客户维护视图* (mapviewdequeuereusableannotationviewwithidentifier 3360 cuequeuereusableannotationview (c if (注释视图==nil (注释视图) c ) initwithannotation 3360 annotation reuseidentifier//must set to no,sowecanshowthecustomcalloutview.annotation view.canshon annotationView.draggable=NO; redenvelopmodel * redenvelopmodel; for(intI=0; iself.mutableArray.count; I ) redenvelopmodel=self.mutable array [ I ]; if (annotation==self.annotations [ I ] (/这里是生成相应标记点的视图[ annotation view.portraitimageviewaddtarget 3360 ] annotation view.portrait imageview.tag=1000 I; [ annotation view.portraitimageviewsd _ setbackgroundimagewithurl : [ nsurlurlwithstring 3360 imageurl (redenvelopmodel . forstate : uicontrolstatenormalplaceholderimage : [ uiimageimagenamed : @ ' default _ hong Bao _ BG ' ]; //向标记点添加图像} }返回注释视图; }

7 .最后响应对应的点击事件即可

-(void )标记器动作: (uibutton * )发送器{

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。