Who sends the message to drawRect?


#1

I get that when I create a View and I then I send that View to a window or a subview the drawRect method gets done.

but when does that take place? when the view is created? or when it is assigned? I realize that I am not completely clear on when some methods are called, and I am trying to follow that flow to better understand. I think there are some system messages happening by default that I do not fully grasp.


#2

When the view needs to be drawn, redrawn, and when you explicitly send the setNeedsDisplay message.

See: UIView Class Reference and Companion guide: View Programming Guide for iOS.


#3

Well, if you are very curious, skip to the CALayer chapter and read the for the more curious.