Drawing route partially not getting required output in iPhone MapView

后端 未结 1 1845
心在旅途
心在旅途 2021-01-28 03:23

I am trying to draw route between two points using polyline . I got somewhat route but not correct and I think it will get confused at the turn . I am using google api for getti

相关标签:
1条回答
  • 2021-01-28 03:46

    After your line

    NSArray *steps=[[aary objectAtIndex:0]valueForKey:@"steps"];   
    

    replace lines with this may work

    NSMutableArray *polyLinesArray = [[NSMutableArray alloc] init];
    
    for (int i = 0; i < [steps count]; i++)
    {
        NSString* encodedPoints = [[[steps objectAtIndex:i] objectForKey:@"polyline"] valueForKey:@"points"];
        MKPolyline *route = [self polylineWithEncodedString:encodedPoints];
        [polyLinesArray addObject:route];
    }
    
    [self.mapView addOverlays:polyLinesArray];
    [polyLinesArray release];
    
    0 讨论(0)
提交回复
热议问题