Why does drawRect: work without calling [super drawrect:rect]?

前端 未结 4 1290
悲&欢浪女
悲&欢浪女 2021-02-04 11:23

I\'m overriding drawRect: in one of my views and it works even without calling [super drawrect:rect]. How does that work?

- (void)drawRect:(CGRect)rect{  
    C         


        
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-04 12:05

    I'm sure subview doesn't work without calling [super drawrect:rect].If you need to keep the superview's drawing ,you must add [super drawrect:rect] in the subview's drawrect:rect,or you'll replace the drawing.

提交回复
热议问题