Einstellen eines CGContext Transparenten Hintergrunds

Ich bin immer noch Schwierigkeiten mit dem zeichnen einer Linie mit CGContext. Habe ich eigentlich gehen, um Linie zu zeichnen, aber jetzt muss ich den hintergrund des "Rect" zu werden transparent, so dass der vorhandene hintergrund zeigt thru. Hier mein test-code:

(void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
    CGContextSetAlpha(context,0.0);
    CGContextFillRect(context, rect);

    CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor);
    CGContextSetLineWidth(context, 5.0);
    CGContextMoveToPoint(context, 100.0,0.0);
    CGContextAddLineToPoint(context,100.0, 100.0);
    CGContextStrokePath(context);
}

Irgendwelche Ideen?

InformationsquelleAutor der Frage Jim B | 2010-01-24

Schreibe einen Kommentar