2016-03-31 150 views
0

当我使用下面的代码时,它给了我一个直线折线,但我想根据路线曲折,如图所示我张贴。我正在使用以下代码。我想使用谷歌地图来绘制曲折折线

GMSMarker *marker = [[GMSMarker alloc] init]; 
marker.position = CLLocationCoordinate2DMake(center.latitude,center.longitude); 
marker.title = @""; 
marker.snippet = @""; 
//marker.map = mapView_; 
marker.map = self.mapView; 

marker.groundAnchor=CGPointMake(0.5,0.5); 
marker.map=_mapView; 
GMSMutablePath *path = [GMSMutablePath path]; 
[path addCoordinate:CLLocationCoordinate2DMake(userLatitude,userLongitude)]; 
[path addCoordinate:CLLocationCoordinate2DMake(center.latitude,center.longitude)]; 

GMSPolyline *rectangle = [GMSPolyline polylineWithPath:path]; 
rectangle.strokeWidth = 2.f; 
rectangle.map = _mapView; 
self.view=_mapView; 

[1]: http://i.stack.imgur.com/mVvIV.png 

回答

0

我想你可能要找的是从Google Directions API获取方向,然后沿着这条路径绘制多段线。 也许this是你在找什么。