Instance Method

imageForBounds:textContainer:characterIndex:

Returns the image object rendered by the layout manager in the given image bounds rectangle inside the text container.

Required.

Declaration

iOS, Mac Catalyst, tvOS
- (UIImage *)imageForBounds:(CGRect)imageBounds textContainer:(NSTextContainer *)textContainer characterIndex:(NSUInteger)charIndex;
macOS
- (NSImage *)imageForBounds:(NSRect)imageBounds textContainer:(NSTextContainer *)textContainer characterIndex:(NSUInteger)charIndex;

Parameters

imageBounds

The rectangle in which the image is laid out.

textContainer

The text container in which the image is laid out.

charIndex

The character location inside the text storage for the attachment character.

Return Value

The image rendered in the bounds rectangle.

Discussion

The method should return an image appropriate for the target rendering context derived by arguments passed into this method. The NSTextAttachment implementation returns the text attachment’s image when non-nil. If the image is nil, it returns an image based on the text attachment’s contents and fileType properties.

See Also

New Methods

- attachmentBoundsForTextContainer:proposedLineFragment:glyphPosition:characterIndex:

Returns the layout bounds of the text attachment to the layout manager.

Required.