2016-03-31 12 views
0

を使用してジグザグポリラインを描画したい場合は以下のコードを使用していますが、直線のポリラインを与えていますが、画像iのように経路に従ってジグザグが欲しいです。次のコードを使用しています。Googleマップ

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があなたが探しているものです。