百度地图支持地图状态,手势交互,和地图覆盖物交互等事件的监听,并提供了相应的事件监听方法。
地图状态事件监听:
/***地图状态改变完成后会调用此接口*@param mapview 地图view*/-(void)mapstatusdidchanged:(bmkmapview*)mapview;/***地图进入/移出室内图会调用此接口*@param mapview 地图view*@param flag yes:进入室内图; no:移出室内图*@param info 室内图信息*/-(void)mapview:(bmkmapview*)mapview baseindoormapwithin:(bool)flag baseindoormapinfo:(bmkbaseindoormapinfo*)info;/***地图初始化完毕时会调用此接口*@param mapview 地图view*/-(void)mapviewdidfinishloading:(bmkmapview*)mapview;/***地图渲染完毕后会调用此接口*@param mapview 地图view*/-(void)mapviewdidfinishrendering:(bmkmapview*)mapview;/***地图渲染每一帧画面过程中,以及每次需要重绘地图时(例如添加覆盖物)都会调用此接口*@param mapview 地图view*@param status 此时地图的状态*/-(void)mapview:(bmkmapview*)mapview ondrawmapframe:(bmkmapstatus*)status;/***地图区域即将改变时会调用此接口*@param mapview 地图view*@param animated 是否动画*/-(void)mapview:(bmkmapview*)mapview regionwillchangeanimated:(bool)animated;/***地图区域即将改变时会调用此接口*@param mapview 地图view*@param animated 是否动画*@param reason 地区区域改变的原因*/-(void)mapview:(bmkmapview*)mapview regionwillchangeanimated:(bool)animated reason:(bmkregionchangereason)reason;/***地图区域改变完成后会调用此接口*@param mapview 地图view*@param animated 是否动画*/-(void)mapview:(bmkmapview*)mapview regiondidchangeanimated:(bool)animated;/***地图区域改变完成后会调用此接口*@param mapview 地图view*@param animated 是否动画*@param reason 地区区域改变的原因*/-(void)mapview:(bmkmapview*)mapview regiondidchangeanimated:(bool)animated reason:(bmkregionchangereason)reason;
地图手势交互事件监听:
/***点中底图空白处会回调此接口*@param mapview 地图view*@param coordinate 空白处坐标点的经纬度*/-(void)mapview:(bmkmapview*)mapview onclickedmapblank:(cllocationcoordinate2d)coordinate;/***双击地图时会回调此接口*@param mapview 地图view*@param coordinate 返回双击处坐标点的经纬度*/-(void)mapview:(bmkmapview*)mapview ondoubleclick:(cllocationcoordinate2d)coordinate;/***长按地图时会回调此接口*@param mapview 地图view*@param coordinate 返回长按事件坐标点的经纬度*/-(void)mapview:(bmkmapview*)mapview onlongclick:(cllocationcoordinate2d)coordinate;/***3dtouch 按地图时会回调此接口(仅在支持3d touch,且fouchtouchenabled属性为yes时,会回调此接口)*@param mapview 地图view*@param coordinate 触摸点的经纬度*@param force 触摸该点的力度(参考uitouch的force属性)*@param maximumpossibleforce 当前输入机制下的最大可能力度(参考uitouch的maximumpossibleforce属性)*/-(void)mapview:(bmkmapview*)mapview onforcetouch:(cllocationcoordinate2d)coordinate force:(cgfloat)force maximumpossibleforce:(cgfloat)maximumpossibleforce;
地图覆盖物交互事件监听:
/***点中底图标注后会回调此接口*@param mapview 地图view*@param mappoi 标注点信息*/-(void)mapview:(bmkmapview*)mapview onclickedmappoi:(bmkmappoi*)mappoi;/***根据anntation生成对应的view*@param mapview 地图view*@param annotation 指定的标注*@return 生成的标注view*/-(bmkannotationview*)mapview:(bmkmapview*)mapview viewforannotation:(id <bmkannotation>)annotation;/***当mapview新添加annotation views时,调用此接口*@param mapview 地图view*@param views 新添加的annotation views*/-(void)mapview:(bmkmapview*)mapview didaddannotationviews:(nsarray*)views;/***当选中一个annotation views时,调用此接口*@param mapview 地图view*@param view 选中的annotation views*/-(void)mapview:(bmkmapview*)mapview didselectannotationview:(bmkannotationview*)view;/***当取消选中一个annotation views时,调用此接口*@param mapview 地图view*@param view 取消选中的annotation views*/-(void)mapview:(bmkmapview*)mapview diddeselectannotationview:(bmkannotationview*)view;/***拖动annotation view时,若view的状态发生变化,会调用此函数。ios3.2以后支持*@param mapview 地图view*@param view annotation view*@param newstate 新状态*@param oldstate 旧状态*/-(void)mapview:(bmkmapview*)mapview annotationview:(bmkannotationview*)view didchangedragstate:(bmkannotationviewdragstate)newstatefromoldstate:(bmkannotationviewdragstate)oldstate;/***当点击annotation view弹出的泡泡时,调用此接口*@param mapview 地图view*@param view 泡泡所属的annotation view*/-(void)mapview:(bmkmapview*)mapview annotationviewforbubble:(bmkannotationview*)view;/***根据overlay生成对应的view*@param mapview 地图view*@param overlay 指定的overlay*@return 生成的覆盖物view*/-(bmkoverlayview*)mapview:(bmkmapview*)mapview viewforoverlay:(id <bmkoverlay>)overlay;/***当mapview新添加overlay views时,调用此接口*@param mapview 地图view*@param overlayviews 新添加的overlay views*/-(void)mapview:(bmkmapview*)mapview didaddoverlayviews:(nsarray*)overlayviews;/***点中覆盖物后会回调此接口,目前只支持点中bmkpolylineview时回调*@param mapview 地图view*@param overlayview 覆盖物view信息*/-(void)mapview:(bmkmapview*)mapview onclickedbmkoverlayview:(bmkoverlayview*)overlayview;
上一篇
下一篇
本篇文章对您是否有帮助?