关于UIView drawRect方法

来源:互联网 发布:淘宝男装店推荐 知乎 编辑:程序博客网 时间:2024/05/19 03:47

         在子类化UIView时,会自动调用drawRect方法,可以在子类中重载该函数,以实现自己的功能。

另外,当需要重绘时,可调用setNeedsDisplay 或者 setNeedsDisplayInRect方法,而不能直接调用drawRect方法。


This method is called when a view is first displayed or when an event occurs that invalidates a visible part of the view. You should never call this method directly yourself. To invalidate part of your view, and thus cause that portion to be redrawn, call the setNeedsDisplay or setNeedsDisplayInRect: method instead.

原创粉丝点击