谷歌地图ios - 没有显示路线远离道路的长路线图。
用于显示路径的代码:
- (void)addDirections:(NSDictionary *)json {
if ([json objectForKey:@"routes"]) {
if ([[json objectForKey:@"routes"] count] > 0) {
NSDictionary *routes = [json objectForKey:@"routes"][0];
NSDictionary *route = [routes objectForKey:@"overview_polyline"];
NSString *overview_route = [route objectForKey:@"points"];
GMSPath *path = [GMSPath pathFromEncodedPath:overview_route];
GMSPolyline *polyline = [GMSPolyline polylineWithPath:path];
polyline.map = mapView_;
polyline.strokeColor = [UIColor redColor];
polyline.strokeWidth = 10.f;
polyline.geodesic = YES;
}
}
}