Draws the receiver’s text in the specified rectangle.
SDKs
- iOS 2.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- UIKit
Declaration
- (void)drawTextInRect:(CGRect)rect;
Parameters
rect
The rectangle in which to draw the text.
Discussion
You should not call this method directly. If you want to customize the drawing behavior for the text, you can override this method to do your drawing.
By the time this method is called, the current graphics context is already configured with the default environment and text color for drawing. In your overridden method, you can configure the current context further and then invoke super
to do the actual drawing or you can do the drawing yourself. If you do render the text yourself, you should not invoke super
.