- (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;
}

最佳答案

我已经在mapview上制作了应用。因此,即使您要获取正确的路径,也必须使用KMLViewer或使用GoogleMaps。在Google Maps中,您可以执行以下代码

NSString * urlstring = [NSString stringWithFormat:@“ http://maps.google.com/?saddr=%f,%f&daddr=

%f,%f“,sourcelocation.latitude,sourcelocation。经度,destinationlocation.latitude,目的地

ationlocation.longitude];

[[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlstring]];

关于iphone - 如何在iPhone的Mapview中的两个地方之间画线?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10529258/

10-10 02:35