I want to add a UIView to my UIViewController but I want it to be transparent until I decide to create an Oval inside the UIView.
Until I create the oval, I can set my view's alpha to 0 but when I want to add the oval, the background color is still black.
here's what it looks like with a bunch of ovals
In my UIView:
- (void)drawRect:(CGRect)rect
{
[self pushContext];
UIBezierPath *oval = [UIBezierPath bezierPathWithOvalInRect:self.bounds];
[[UIColor redColor] setFill];
[oval fill];
self.opaque = NO;
[self setBackgroundColor:[UIColor clearColor]];
[oval addClip];
[self setBackgroundColor:[UIColor clearColor]];
[self popContext];
}
Please try to use this one
view.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.0];
view.opaque = NO;