viewWillDraw()
Informs the view that it’s required to draw content.
Declaration
func viewWillDraw()Discussion
In response to receiving one of the display methods, the view recurses down the view hierarchy, sending this message to each of the views that may be involved in the display operation.
Subclasses can override this method to move or resize views, mark additional areas as requiring display, or take other actions that can best be deferred until they are required for drawing. During the recursion, setting the needsDisplay property or sending the setNeedsDisplay(_:) message to views in the hierarchy that are about to be drawn is valid and supported, and affects the assessment of the total area to be rendered in that drawing pass.
The following is an example of a generic subclass implementation:
- (void)viewWillDraw {
// Perform some operations before recursing for descendants.
// Now recurse to handle all our descendants.
// Overrides must call up to super like this.
[super viewWillDraw];
// Perform some operations that might depend on descendants
// already having had a chance to update.
}