Desenhando triângulo / flecha em uma linha com CGContext

Estou usando a estrutura de rotear-me para trabalhar com locais. Neste código, o caminho entre dois marcadores (pontos) será desenhado como uma linha.

Minha pergunta: "Qual código devo adicionar se quiser adicionar uma seta no meio (ou no topo) da linha, para que ela aponte a direção"

obrigado



- (void)drawInContext:(CGContextRef)theContext
{
    renderedScale = [contents metersPerPixel];

    float scale = 1.0f / [contents metersPerPixel];

    float scaledLineWidth = lineWidth;
    if(!scaleLineWidth) {
        scaledLineWidth *= renderedScale;
    }
    //NSLog(@"line width = %f, content scale = %f", scaledLineWidth, renderedScale);

    CGContextScaleCTM(theContext, scale, scale);

    CGContextBeginPath(theContext);
    CGContextAddPath(theContext, path);

    CGContextSetLineWidth(theContext, scaledLineWidth);
    CGContextSetStrokeColorWithColor(theContext, [lineColor CGColor]);
    CGContextSetFillColorWithColor(theContext, [fillColor CGColor]);

    // according to Apple's documentation, DrawPath closes the path if it's a filled style, so a call to ClosePath isn't necessary
    CGContextDrawPath(theContext, drawingMode);
}

questionAnswers(4)

yourAnswerToTheQuestion