Which is equivalent to onDraw in iOS

On android, we have onDraw (). What is equivalent in iOS?

+3
source share
3 answers

You probably want to drawRect:, although depending on what you want in your view, there may be other objects of interest (basements and Core Animation layers). See View Programming Guide .

+4
source

If you write a custom view, it is basically -drawRect:what is called in the view every time the system wants to redraw (for example, every time the runloop and flag are executed -setNeedsDisplay).

+1
source

you override the method -drawRectfor UIViewto make a direct drawing on the screen. However, this is often not required for many use cases. If you want, provide more detailed information about what you want to achieve. Could be more iOS.

0
source

All Articles