numberWithInt:
intの数字オブジェクトを作って返します
+(NSNumber *)numberWithInt:(int)value:
解説
整数intの数字オブジェクト(NSNumber)を作って返します。
intは4バイトの整数値
- 2147483647から2147483647まで
返り値
( NSNumber * )
NSNumber
引数
( int )value
int値
フレームワーク
Foundation
クラス
NSNumber
Class Methods
使用可能
10.0
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSNumber *num = [NSNumber numberWithInt:1234567890]; NSLog(@"%d",[num intValue]); NSLog(@"-------------------------------"); NSNumber *num2 = [NSNumber numberWithInt:1234567890]; NSLog(@"%d",[num2 intValue]); NSLog(@"%d byte(s)",sizeof[num intValue]); //テキストフィールドにセット [info setIntValue:[num intValue]]; } @end