statusItemWithLength:
ステータスバーにステータス項目を作って返します
-(NSStatusItem*)statusItemWithLength:(float)length:
解説
ステータスバーにステータス項目を作って返します。
ステータスバーはステータス項目の参照を保持しません。
【length】
0以上の数 ピクセル数
この他に定数があります。
● NSVariableStatusItemLength 必要なピクセル数可変します。
● NSSquareStatusItemLength
返り値
( NSStatusItem* )
NSStatusItemオブジェクト
引数
( float )length
設定するピクセル数
フレームワーク
ApplicationKit
クラス
NSStatusBar
Instance Methods
使用可能
10.0
参照
- removeStatusItem:
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSStatusBar *sBar = [NSStatusBar systemStatusBar]; NSStatusItem *sItem = [sBar statusItemWithLength:NSVariableStatusItemLength]; [sItem retain]; [sItem setTitle: NSLocalizedString(@"SB_title",@"")]; [sItem setHighlightMode:YES]; [sItem setMenu:sbMenu]; NSLog([NSString stringWithFormat:@"%.1f",[sItem length]]); } @end