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

前端 未结 4 1294
悲&欢浪女
悲&欢浪女 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 11:53

    Thanks.. There is no need to call super, because the superclass here is UIView, whose drawRect: does nothing.

    In general, we call setNeedDisplay if we want recall drawRect for drawing.

提交回复
热议问题