objective-c - iOS高德地图的线路规划怎么画线?
PHP中文网
PHP中文网 2017-04-27 09:03:38
0
0
490

//路线点击事件
-(void)rideBtn:(UIButton *)btn{

[self.naviRoute removeFromMapView];

    _search=[[AMapSearchAPI alloc] init];
    _search.delegate=self;

self.naviRoute=[MANaviRoute naviRouteForTransit:self.route.transits[self.currentCourse]];
[self.naviRoute addToMapView:_mapView];
[_mapView setVisibleMapRect:[CommonUtility mapRectForOverlays:self.naviRoute.routePolylines] edgePadding:UIEdgeInsetsMake(RoutePlanningPaddingEdge, RoutePlanningPaddingEdge, RoutePlanningPaddingEdge, RoutePlanningPaddingEdge) animated:YES];


trans=[[AMapTransitRouteSearchRequest alloc] init];
trans.requireExtension=YES;
trans.city=@"jinan";
trans.strategy=0;
trans.origin=[AMapGeoPoint locationWithLatitude:36.6869470000 longitude:117.0890220000];

// trans.destination=[AMapGeoPoint locationWithLatitude:_lat1 longitude:_lng1];
// NSLog(@")))))))))%f(((((((((((%f",_lat1,_lng1);


[_search AMapTransitRouteSearch:trans];

}
////实现路径搜索的回调函数
-(void)onRouteSearchDone:(AMapRouteSearchBaseRequest )request response:(AMapRouteSearchResponse )response{

_search=[[AMapSearchAPI alloc] init];
_search.delegate=self;



NSArray *polylines=nil;
polylines=[CommonUtility polylinesForTransit:self.route.transits[_currentCourse]];
[_mapView addOverlays:polylines];
_mapView.visibleMapRect=[CommonUtility mapRectForOverlays:polylines];

}
这是代码,但是不会画线,有大神帮帮忙,最好具体一点

PHP中文网
PHP中文网

认证0级讲师

répondre à tous(0)
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal