Making UIView transparent Making UIView transparent ios ios

Making UIView transparent


Please try to use this one

view.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.0];view.opaque = NO;


- (id)initWithFrame:(CGRect)frame{    self = [super initWithFrame:frame];    if (self) {        // Initialization code        self.opaque = NO;    }    return self;}- (void)drawRect:(CGRect)rect{    [[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.0] setFill];    UIRectFill(rect);    [self pushContext];    UIBezierPath *oval = [UIBezierPath bezierPathWithOvalInRect:self.bounds];    [[UIColor redColor] setFill];    [oval fill];    [oval addClip];    [self popContext];}


In your ViewController, you could say that opaque is NO. Let's say, your view is named myCustomView.

- (void)viewDidLoad {    [super viewDidLoad];    self.myCustomView.opaque = NO;   }

Or you could just go to the storyboard and uncheck the opaque checkbox like-enter image description here