Instance Method


Marks the specified rectangle of the receiver as needing to be redrawn.


func setNeedsDisplay(_ rect: CGRect)



The rectangular region of the receiver to mark as invalid; it should be specified in the coordinate system of the receiver.


You can use this method or the setNeedsDisplay() to notify the system that your view’s contents need to be redrawn. This method adds the specified rectangle into the view’s current list of invalid rectangles and returns immediately. The view is not actually redrawn until the next drawing cycle, at which point all invalidated views are updated.

You should use this method to request that a view be redrawn only when the content or appearance of the view change. If you simply change the geometry of the view, the view is typically not redrawn. Instead, its existing content is adjusted based on the value in the view’s contentMode property. Redisplaying the existing content improves performance by avoiding the need to redraw content that has not changed.

See Also

Drawing and Updating the View

func draw(CGRect)

Draws the receiver’s image within the passed-in rectangle.

func setNeedsDisplay()

Marks the receiver’s entire bounds rectangle as needing to be redrawn.

var contentScaleFactor: CGFloat

The scale factor applied to the view.

func tintColorDidChange()

Called by the system when the tintColor property changes.