Прозрачный фон в CoreGraphics

Я пытаюсь получить прозрачный фон в компьютерной графике, но он продолжает оставаться черным.

У меня есть следующий код:

- (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
        DLog(@">>> Alloc: DrawingCanvas [0x%X]", (unsigned int)self);
        [self setOpaque:NO];
        [self setBackgroundColor:[UIColor clearColor]];
    }
    return self;
}

- (void) drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGRect frame = rect;
    int counter = 3;

    CGContextClearRect(context, frame);
    CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
    CGContextFillRect(context, frame);
}

Как заставить этот код отображать прозрачный фон?

11
задан Egil 28 February 2011 в 21:59
поделиться