百度地图路线规划中的节点浏览

2017-05-24  本文已影响9人  杨大虾

百度地图路线规划的官方demo里并没有节点浏览,实现按钮点击遍历节点信息可以通过开一个数组装RouteAnnotation,

然后通过百度API中的这个方法实现

/**
 *选中指定的标注,本版暂不支持animate效果
 *@param annotation 指定的标注
 *@param animated 本版暂不支持
 */
- (void)selectAnnotation:(id <BMKAnnotation>)annotation animated:(BOOL)animated;

具体:

- (IBAction)clickRightArrowBtn:(id)sender {
    
    
    _currentAnnotaionIndex++;

    if (_currentAnnotaionIndex < _currentAnnotationList.count){
        
        RouteAnnotation * annotation = (RouteAnnotation *)_currentAnnotationList[_currentAnnotaionIndex];
        
        [_mapView selectAnnotation:annotation animated:NO];
        _mapView.centerCoordinate = annotation.coordinate;
       
    }else{
        
        _currentAnnotaionIndex --;
    }

}
上一篇下一篇

猜你喜欢

热点阅读