//路線點擊事件
-(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];
}
這是程式碼,但不會畫線,有大神幫忙,最好具體一點