macOS/iOS API解説

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

目次

setAttributedStringForNil:

数字フォーマッタのnilの時の属性付き文字列をセットします
-(void)setAttributedStringForNil:(NSAttributedString *)newAttributedString:

解説

数字フォーマッタのnilの時の属性付き文字列をセットします。
初期設定は空の文字列です。

返り値

( void )

なし

引数

( NSAttributedString * )newAttributedString

属性付き文字列

クラス

NSNumberFormatter

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
NSNumberFormatter *numFormat = [[[NSNumberFormatter alloc] init] autorelease] ;
[numFormat setAttributedStringForNil:[[NSAttributedString alloc] initWithString:@"nil!!!"]];
[numFormat setNegativeFormat:@"-#,##0.00"];
[myOutlet setFormatter:numFormat];

NSLog([[[myOutlet formatter] attributedStringForNil] string]);
}


@end