- (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;
}
2 に答える
1
ステーションとステーションの間に適切な線を引き、そのためにKMLparserを使用したいと思います。
そのサブクラスを使用してから、このメソッドを実装します。
-(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];
}
于 2012-05-10T07:34:32.840 に答える
1
mapviewでアプリを作成しました。したがって、適切なパスを取得したい場合は、KMLViewerを使用するか、GoogleMapsを使用する必要があります。GoogleMapsでは、このコードを実行できます。
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]];
于 2012-05-11T19:02:24.553 に答える