Instance Method

attachmentBoundsForTextContainer:proposedLineFragment:glyphPosition:characterIndex:

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

Required.

Declaration

iOS, Mac Catalyst, tvOS
- (CGRect)attachmentBoundsForTextContainer:(NSTextContainer *)textContainer proposedLineFragment:(CGRect)lineFrag glyphPosition:(CGPoint)position characterIndex:(NSUInteger)charIndex;
macOS
- (NSRect)attachmentBoundsForTextContainer:(NSTextContainer *)textContainer proposedLineFragment:(NSRect)lineFrag glyphPosition:(CGPoint)position characterIndex:(NSUInteger)charIndex;

Parameters

textContainer

The text container for the text being laid out.

lineFrag

The line fragment containing the text attachment.

position

The glyph location inside lineFrag which is the origin of the returned bounds rectangle.

charIndex

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

Return Value

The bounds rectangle of the text attachment if not CGRectZero; otherwise, the rectangle of the size property of the attachment’s image property.

Discussion

Conforming objects can implement more sophisticated logic for negotiating the attachment bounds based on the available container space and proposed line fragment rectangle.

See Also

New Methods

- imageForBounds:textContainer:characterIndex:

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

Required.