iOS development - View drawing cycle -

iOS development - View drawing cycle

ios, programming, mobile development, views, uiview

Views are drawn as needed. Upon render or changes, the system triggers a draw on the view. The view’s draw(_:) method is called by the system for views that contain custom UIKit or Core Graphics content, which means that a custom implementation of that method is necessary to control how its view is drawn.

Views can be programmatically redrawn by calling the setNeedsDisplay() (or setNeedsDisplay(_:) method on the view to be redrawn. The system will redraw the view on the next drawing cycle, meaning that multiple calls on multiple views can result in simultaneous redraws of those views when the system reaches the next drawing cycle.