A Boolean value that determines whether the view’s bounds should be automatically cleared before drawing.
- iOS 2.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
When set to
YES, the drawing buffer is automatically cleared to transparent black before the
draw method is called. This behavior ensures that there are no visual artifacts left over when the view’s contents are redrawn. If the view’s
opaque property is also set to
background property of the view must not be
nil or drawing errors may occur. The default value of this property is
If you set the value of this property to
NO, you are responsible for ensuring the contents of the view are drawn properly in your
draw method. If your drawing code is already heavily optimized, setting this property is
NO can improve performance, especially during scrolling when only a portion of the view might need to be redrawn.