At first I think you should know the responsibilities of UIView and UIViewController. UIView is mainly responsible for drawing (cancels touchBegin, ToucheMove, etc.), animates, controls subviews and processes the event; The UIViewController is mainly responsible for loading, unloading views, etc.
So, you should "draw" this line in your individual view (UIView), and not view the controller.
Second: if you need to display only simple shapes or lines. I suggest you use the controls and images of the user interface. Even "drawRect" is not recommended, as this will lead to more resources being used. Of course, OpenGL needs a lot of resources.
Elliot Chen Jun 09 '10 at 7:21 2010-06-09 07:21
source share