UIView对象的drawRect:方法到底是做什么的?

时间:2020-12-22 19:41:45

I have read the official documentation and I am a bit confused. Does this method draw the view itself (what we see on the screen)?

我已阅读官方文档,我有点困惑。此方法是否自己绘制视图(我们在屏幕上看到的内容)?

1 个解决方案

#1


2  

In short, yes. This method is called by the system when a view's backing layer needs to be drawn by the rendering system. This article gives a great explanation of how to method works, and how things are drawn onto the screen in general.

简而言之,是的。当需要由渲染系统绘制视图的背衬层时,系统会调用此方法。本文对如何使用方法以及如何将内容绘制到屏幕上进行了很好的解释。

#1


2  

In short, yes. This method is called by the system when a view's backing layer needs to be drawn by the rendering system. This article gives a great explanation of how to method works, and how things are drawn onto the screen in general.

简而言之,是的。当需要由渲染系统绘制视图的背衬层时,系统会调用此方法。本文对如何使用方法以及如何将内容绘制到屏幕上进行了很好的解释。