macOS/iOS API解説

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

目次

descriptionWithLocale:

ローカライズして返します
-(NSString *)descriptionWithLocale:(NSDictionary *)aLocale:

解説

レシーバの値を示す文字列を返します。aLocaleで書式を設定します。
書式を設定したくない場合はnilをセットします。

返り値

( NSString * )

レシーバの内容

引数

( NSDictionary * )aLocale

クラス

NSNumber

Instance Methods

使用可能

10.0

参照

- stringValue

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
	NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
										@"%i",@"int",
										@"%0.1g",@"float",
										@"%i",@"char",
										
										nil];
										
	NSNumber *num1 = [NSNumber numberWithFloat:233.3333333];
	NSLog(@"%@",[num1 descriptionWithLocale:dict]);

    NSNumber *num2 = [NSNumber numberWithInt:123];
	NSLog(@"%@",[num2 descriptionWithLocale:dict]);

}

@end