Heim > Fragen und Antworten > Hauptteil
//路线点击事件
-(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];
}
这是代码,但是不会画线,有大神帮帮忙,最好具体一点