在Google Map iOS上使用多个标记绘制路线

在Google Map iOS上使用多个标记绘制路线,ios,iphone,google-maps-markers,Ios,Iphone,Google Maps Markers,我是iPhone开发新手,在我的应用程序中,我想在两点之间绘制路线,并显示路线上的多个标记。现在我已经完成了两点之间的路线,但我不知道如何在路线上绘制多个标记。所以请帮我做这个 提前感谢 _markerStart = [GMSMarker new]; _markerStart.title = [[[routeDict objectForKey:@"legs"] objectAtIndex:0]objectForKey:@"start_address"]; _markerStart.icon =

我是iPhone开发新手,在我的应用程序中,我想在两点之间绘制路线,并显示路线上的多个标记。现在我已经完成了两点之间的路线,但我不知道如何在路线上绘制多个标记。所以请帮我做这个

提前感谢

_markerStart = [GMSMarker new];
_markerStart.title = [[[routeDict objectForKey:@"legs"] objectAtIndex:0]objectForKey:@"start_address"];
_markerStart.icon = newImage; //[UIImage imageNamed:@"startMarker.png"];
_markerStart.map = gmsMapView;
_markerStart.position = startPoint;

_markerFinish = [GMSMarker new];
_markerFinish.title = [[[routeDict objectForKey:@"legs"] objectAtIndex:0]objectForKey:@"end_address"];
_markerFinish.icon = newImage; //[UIImage imageNamed:@"finishMarker.png"];
_markerFinish.map = gmsMapView;
_markerFinish.position = endPoint;

这里我添加了起点和终点标记。

当您完成绘制两点之间的路线时,您将获得路线的坐标。你可以从这些坐标中提取一些坐标,然后在谷歌地图上绘制它们

对于绘制管线,您可能使用了
GMSPolyline
。对于多段线,必须使用
GMSPath
。从路径中,你们可以通过使用方法得到坐标

-(CLLocationCoordinate2D)coordinateAtIndex:(NSUInteger)index

您可以使用这些坐标在路线上绘制标记

检查此代码(此处gmsPath为
gmsPath
编辑

//GMSPath *gmsPath;
//NSString *title;
for (int i = 0; i < [gmsPath count]; i++) {
    CLLocationCoordinate2D location = [gmsPath coordinateAtIndex: i];
    GMSMarker *marker = [GMSMarker markerWithPosition:location];
    marker.title = title;
    marker.icon = [UIImage imageNamed:@"marker_img.png"];
    marker.map = self.mapView;
}
//GMSPath*GMSPath;
//NSString*标题;
对于(int i=0;i<[gmsPath count];i++){
CLLocationCoordinate2D位置=[gmsPath CoordinateIndex:i];
GMSMarker*marker=[GMSMarker marker with position:location];
marker.title=标题;
marker.icon=[UIImage ImageName:@“marker_img.png”];
marker.map=self.mapView;
}

这将为每个坐标绘制标记

您是否只完成了端点的打印标记?或者绘制完整的路由?耶..现在我想了解更多关于路由的信息,因为循环条件给出错误:二进制表达式的操作数无效