Interface NSTextAttachmentLayout

  • All Known Implementing Classes:
    NSTextAttachment

    public interface NSTextAttachmentLayout
    This protocol defines the interface to attachment objects from NSTextLayoutManager
    • Method Detail

      • attachmentBoundsForAttributesLocationTextContainerProposedLineFragmentPosition

        CGRect attachmentBoundsForAttributesLocationTextContainerProposedLineFragmentPosition​(@NotNull
                                                                                              @NotNull NSDictionary<java.lang.String,​?> attributes,
                                                                                              @NotNull
                                                                                              @NotNull NSTextLocation location,
                                                                                              @Nullable
                                                                                              @Nullable NSTextContainer textContainer,
                                                                                              CGRect proposedLineFragment,
                                                                                              CGPoint position)
        Returns the layout bounds. The bounds origin is interpreted to match position inside proposedLineFragment. The NSTextAttachment implementation returns -bounds if not CGRectZero; otherwise, it derives the bounds value from image.size. Conforming objects can implement more sophisticated logic for negotiating the frame size based on the available container space and proposed line fragment rect. API-Since: 15.0
      • imageForBoundsAttributesLocationTextContainer

        @Nullable
        @Nullable UIImage imageForBoundsAttributesLocationTextContainer​(CGRect bounds,
                                                                        @NotNull
                                                                        @NotNull NSDictionary<java.lang.String,​?> attributes,
                                                                        @NotNull
                                                                        @NotNull NSTextLocation location,
                                                                        @Nullable
                                                                        @Nullable NSTextContainer textContainer)
        Returns the image object rendered at bounds inside textContainer. It should return an image appropriate for the target rendering context derived by arguments to this method. The NSTextAttachment implementation returns -image when non-nil. If -image==nil, it returns an image based on -contents and -fileType properties. API-Since: 15.0
      • viewProviderForParentViewLocationTextContainer

        @Nullable
        @Nullable NSTextAttachmentViewProvider viewProviderForParentViewLocationTextContainer​(@Nullable
                                                                                              @Nullable UIView parentView,
                                                                                              @NotNull
                                                                                              @NotNull NSTextLocation location,
                                                                                              @Nullable
                                                                                              @Nullable NSTextContainer textContainer)
        Returns the text attachment view provider corresponding to -fileType. The default implementation queries the text attachment view provider class via +[NSTextAttachment textAttachmentViewProviderClassForFileType:]. When non-nil, it instantiates a view, then, fills properties declared in NSTextAttachmentViewProvider if implemented API-Since: 15.0