macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

setAttachmentCell:

アタッチメントセルをセットします
-(void)setAttachmentCell:(id <NSTextAttachmentCell>)aCell:

解説

アタッチメントセルをセットします。

返り値

( void )

なし

引数

( id <NSTextAttachmentCell> )aCell

セル

フレームワーク

ApplicationKit

クラス

NSTextAttachment

Instance Methods

使用可能

10.0

参照

- setFileWrapper:
- setImage:(NSCell)
-icon (NSFileWrapper)
- attachmentCell

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
    //テキストアタッチメント
    NSTextAttachment *theAttachment;
    NSTextAttachmentCell *bCell = [[[NSTextAttachmentCell alloc] initImageCell:nil] autorelease];
    //ファイルラッパ
       //テキストアタッチメント
    theAttachment = [[[NSTextAttachment alloc] init] autorelease];
    
    [theAttachment setAttachmentCell:bCell];
    //
    [[myOutlet textStorage] appendAttributedString:
            [NSAttributedString attributedStringWithAttachment:theAttachment]];
}

@end