【发布时间】:2011-10-10 21:31:45
【问题描述】:
我想获取地图包中两点之间的路线! 我做了一些谷歌工作,发现了这个:-http://spitzkoff.com/craig/?p=108
我曾用它来显示地图和图钉:-
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationController.navigationBarHidden=NO;
self.title=@"Map";
CLLocationCoordinate2D location;
location.latitude=[latLabel doubleValue];
location.longitude=[longLabel doubleValue];
MKCoordinateRegion region;// = MKCoordinateRegionMakeWithDistance(CLLocationCoordinate2DMake((location.latitude) / 2.0, (location.longitude) / 2.0), 1000.0, 1000.0);
region.center=location;
region.span.latitudeDelta =0.1;
region.span.longitudeDelta =0.1;
addAnnotation=[[AddressAnnotation alloc] initWithCoordinate:location];
NSLog(@"city=mapview=>%@",City);
NSLog(@"adress=mapview=>%@",Address);
addAnnotation.title=City;
addAnnotation.subtitle=Address;
[mapView addAnnotation:addAnnotation];
[mapView setRegion:region animated:YES];
}
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(AddressAnnotation *) annotation
{
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
annView.pinColor=MKPinAnnotationColorRed;
annView.draggable=TRUE;
annView.animatesDrop=TRUE;
annView.canShowCallout=YES;
annView.calloutOffset=CGPointMake(-5,5);
annView.draggable=TRUE;
return annView;
}
和注释类来显示名称和地址。但是我应该如何添加更多来显示两点之间的路线。
请帮帮我。
提前致谢
【问题讨论】: