0
//inside init
_color = [UIColor orangeColor];
self.backgroundColor = [UIColor clearColor];
self.clearsContextBeforeDrawing = NO;

//inside drawRect
CGContextRef ctx = UIGraphicsGetCurrentContext();

CGContextSaveGState(ctx);
    CGContextAddEllipseInRect(ctx, rect);
    CGContextSetFillColorWithColor(ctx,
                                   _color.CGColor);
    CGContextFillPath(ctx);
CGContextRestoreGState(ctx);

The background keeps showing up as white rather then transparent. The ellipse also does not change color and shows up as black. Thank in advance to anyone who takes a look.

Yogurt
  • 2,913
  • 2
  • 32
  • 63

1 Answers1

0

I think you can refer to this answer for your transparency issue : Setting A CGContext Transparent Background

As for your ellipse color issue, it correctly display as an orange ellipse on my simulator so you may check at possible overlays or other possible side effects from other parts from your code.

Community
  • 1
  • 1
Alexis C.
  • 4,898
  • 1
  • 31
  • 43
  • I was being a moron and I set the background to clear in the init but not in awakeFromNib. But thanks for your speedy response. – Yogurt Mar 05 '13 at 04:00