美文网首页
百度地图路线规划中的节点浏览

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

作者: 杨大虾 | 来源:发表于2017-05-24 16:44 被阅读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 --;
        }
    
    }
    

    相关文章

      网友评论

          本文标题:百度地图路线规划中的节点浏览

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