attributedStringWithAttachment:
テキストアタッチメント付きの属性付き文字列を返します
+(NSAttributedString *)attributedStringWithAttachment:(NSTextAttachment *)attachment:
解説
テキストアタッチメント付きの属性付き文字列を返します
返り値
( NSAttributedString * )
属性付き文字列
引数
( NSTextAttachment * )attachment
テキストアタッチメント
フレームワーク
ApplicationKit
クラス
NSAttributedStringAdditions
Class Methods
使用可能
10.1
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //テキストアタッチメント NSTextAttachment *theAttachment; //ファイルラッパ NSFileWrapper *theWrapper = [[[NSFileWrapper alloc] initWithPath: [[NSBundle mainBundle] pathForResource:@"image" ofType:@"tiff"]] autorelease]; //テキストアタッチメント theAttachment = [[[NSTextAttachment alloc] initWithFileWrapper:theWrapper] autorelease]; // [[myOutlet textStorage] appendAttributedString: [NSAttributedString attributedStringWithAttachment:theAttachment]]; NSLog([[theAttachment fileWrapper] filename]); } @end