Reputation: 1510
- (MKOverlayView *)mapView:(MKMapView *)mapView12 viewForOverlay:(id <MKOverlay>)overlay
{
MKPolylineView *overlayView = nil;
if (nil == overlayView)
{
overlayView = [[[MKPolylineView alloc] initWithOverlay:overlay] autorelease];
overlayView.strokeColor = [UIColor blueColor];
overlayView.lineWidth = 5.0;
}
return overlayView;
}
Upvotes: 3
Views: 437
Reputation: 26
i have made app on mapview. so just if you want get proper path you have to use KMLViewer or use GoogleMaps .In google Maps u can do this code
NSString *urlstring=[NSString stringWithFormat:@"http://maps.google.com/?saddr=%f,%f&daddr=
%f,%f",sourcelocation.latitude,sourcelocation.longitude,destinationlocation.latitude,destin
ationlocation.longitude];
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlstring]];
Upvotes: 1
Reputation: 390
i think, you want to draw the proper line between to station then use the KMLparser for that.
use the subclass of it and then implemnet this method :
-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay
{
return [kml viewForOverlay:overlay];
}
// add the pin in mapview
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
return [kml viewForAnnotation:annotation];
}
Upvotes: 1