搜尋

首頁  >  問答  >  主體

objective-c - iOS高德地圖的路線規劃怎麼畫線?

//路線點擊事件
-(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(((%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中文网2763 天前483

全部回覆(0)我來回復

無回覆
  • 取消回覆