Zeichnen Sie ein einfaches Kreisbild

Ich versuche ein 20x20 UIImage mit einem einfachen blauen Kreis zu machen. Ich versuche es mit dieser Funktion, aber das Ergebnis ist ein blauer Kreis in einem schwarzen Quadrat. Wie entferne ich das schwarze Quadrat um den Kreis?

Funktion:

+ (UIImage *)blueCircle {
    static UIImage *blueCircle = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        UIGraphicsBeginImageContextWithOptions(CGSizeMake(20.f, 20.f), YES, 0.0f);
        CGContextRef ctx = UIGraphicsGetCurrentContext();
        CGContextSaveGState(ctx);

        CGRect rect = CGRectMake(0, 0, 20, 20);
        CGContextSetFillColorWithColor(ctx, [UIColor cyanColor].CGColor);
        CGContextFillEllipseInRect(ctx, rect);

        CGContextRestoreGState(ctx);
        blueCircle = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();

    });
    return blueCircle;
}

tatsächliche Ergebnis:

Antworten auf die Frage(6)

Ihre Antwort auf die Frage