Setting A CGContext Transparent Background

后端 未结 8 743
长发绾君心
长发绾君心 2020-12-08 09:15

I am still struggling with drawing a line with CGContext. I have actually go to line to draw, but now I need the background of the Rect to be transparent so the existing ba

相关标签:
8条回答
  • 2020-12-08 10:01

    I have the same problem, then I find it is. I overwrite the init Method is -(id)initWithFrame:(CGRect)rect. In this method self.background = [UIColor clearColor]; but i use this view in xib file !!! That will call the init method is

    -(id)initWithCoder:(NSCoder*)aDecoder;
    

    So overwrite all the init Method and setup BackgroundColor will work OK.

    0 讨论(0)
  • 2020-12-08 10:04

    Having trouble understanding the question here, but if you're unable to have a "background" UIView show through a "top" view into which you're drawing, one solution is topView.backgroundColor = [UIColor clearColor]; I was having (I think) this same problem and this solved it for me.

    0 讨论(0)
提交回复
热议问题