2

I had an application in which i am showing polylines in mkmapkit like this -

self.routeLine = [MKPolyline polylineWithCoordinates:coordinateArray count:4];
//[self.mapView setVisibleMapRect:[self.routeLine boundingMapRect]]; //If you want the route to be visible

[self.mapView addOverlay:self.routeLine];

-(MKPolylineRenderer *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay
{
    if(overlay == self.routeLine)
    {
        if(nil == self.routeLineView)
        {
            self.routeLineView = [[MKPolylineRenderer alloc] initWithPolyline:self.routeLine];
            self.routeLineView.fillColor = [UIColor redColor];
            self.routeLineView.strokeColor = [UIColor redColor];
            self.routeLineView.lineWidth = 2;

        }

        return self.routeLineView;
    }

    return nil;
}

Now i want to add an arrow over that polylines to show the direction like this

How to draw an arrow on every polyline segment on Google Maps V3

. I googled for the same but no luck so far. Can anybody direct me on how to achieve this?

Community
  • 1
  • 1
hacker
  • 8,919
  • 12
  • 62
  • 108

1 Answers1

0

I would suggest actually drawing the arrow yourself with an MKOverlayPathRenderer, as I do in this example:

enter image description here

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • I don't know what you want to achieve, but the point of MKOverlayPathRenderer is that it just draws a CGPath. So if you can draw it, you can display it on the map. – matt Sep 20 '16 at 04:11
  • i want to achieve like this http://stackoverflow.com/questions/31305497/how-to-draw-an-arrow-on-every-polyline-segment-on-google-maps-v3 – hacker Sep 20 '16 at 04:14
  • Well, you know the coordinates on the map (because that's where the end of the line is), so just draw the arrow at that place. – matt Sep 20 '16 at 04:15
  • i joined the 3 points through polylines(in our case not route just straight lines ,but i need to place a forward arrow at the middle of that each poliline.is that possible inside that polyline ) – hacker Sep 20 '16 at 04:21
  • can u pls add an answer with arrow drawing code over that lines ? – hacker Sep 20 '16 at 04:34