macOS/iOS API解説

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

目次

setAttributedAlternateTitle:

ボタンを押込んだときの属性付文字をセットします
-(void)setAttributedAlternateTitle:(NSAttributedString *)aString:

解説

ボタンを押込んだときの属性付文字をセットします。
ボタンタイプによって代理のタイトルを表示しないものがあります。

返り値

( void )

なし

引数

( NSAttributedString * )aString

セットする属性付代理タイトル

フレームワーク

ApplicationKit

クラス

NSButton

Instance Methods

使用可能

10.0

参照

- setAttributedTitle:
- setButtonType:
- setFont:(NSButtonCell)

例文

#import "MyObject.h"

@implementation MyObject

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

//ボタンmyOutLetに代理タイトルセット
[myOutlet setAttributedAlternateTitle:attStr];

}

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