setTextAttributesForNegativeValues:
負の数のテキスト属性の辞書をセットします
-(void)setTextAttributesForNegativeValues:(NSDictionary *)newAttributes:
解説
負の数のテキスト属性の辞書(NSDictionary)をセットします。
カラーはセルがフォーカスされていないときしか変わりません。
セルにフォーカスがあるときは黒で表示されます。
負の数を赤で表示する簡単な方法は、フォーマットに[Red]をつけます。
返り値
( void )
なし
引数
( NSDictionary * )newAttributes
属性辞書
フレームワーク
Foundation
クラス
NSNumberFormatter
Instance Methods
使用可能
10.0
参照
- textAttributesForNegativeValues
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSNumberFormatter *numFormat = [[[NSNumberFormatter alloc] init] autorelease] ; NSMutableDictionary *formatAtrr = [NSMutableDictionary dictionary]; [numFormat setFormat:@"#,##0.00;-#,##0.00"]; [formatAtrr setObject:[NSColor redColor] forKey:@"NSColor"]; [numFormat setTextAttributesForNegativeValues:formatAtrr]; [[myOutlet cell] setFormatter:numFormat]; NSLog([[[[myOutlet cell] formatter] textAttributesForNegativeValues] description]); } @end