macOS/iOS API解説

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

目次

setAttributedStringValue:

属性付文字列をセットします
-(void)setAttributedStringValue:(NSAttributedString *)attribStr:

解説

属性付文字列をセットします。

返り値

( void )

なし

引数

( NSAttributedString * )attribStr

属性付文字列

フレームワーク

ApplicationKit

クラス

NSCell

Instance Methods

使用可能

10.0

参照

- attributedStringValue

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
//属性付き文字列作成
NSAttributedString *attStr = [[[NSMutableAttributedString alloc] initWithString:@"Bold Title" attributes:[self systemBoldFontAttributes]] autorelease];

//セット
[bCell1 setAttributedStringValue:attStr];

}

//太字のシステムフォント属性を返す。
- (NSDictionary*)systemBoldFontAttributes {
    return [NSDictionary dictionaryWithObject: [NSFont boldSystemFontOfSize:[NSFont systemFontSize]] forKey:NSFontAttributeName];
}


@end