Instance Method

initWithData:ofType:

Initializes a new NSTextAttachment object with the given data.

Declaration

- (instancetype)initWithData:(NSData *)contentData ofType:(NSString *)uti;

Parameters

contentData

Data to use for the text attachment contents. Can be nil.

uti

A uniform type identifier specifying the data type of the attachment contents. Can be nil.

Return Value

A new NSTextAttachment object.

Discussion

This method is the designated initializer for the NSTextAttachment class on iOS.

When either contentData or uti is nil, the receiver is consider to be an attachment without document contents. In this case, the NSAttributedString external file writing methods try to save the value of the image property instead.

See Also

Initializing a Text Attachment

- initWithFileWrapper:

Creates a new text attachment object to contain the given file wrapper.

+ textAttachmentWithImage:

Creates a new text attachment object to contain the specified image