floatValue
floatとしてレシーバーの値を返します
解説
floatとしてレシーバーの値を返します。
返り値
( float )
float
引数
フレームワーク
Foundation
クラス
NSNumber
Instance Methods
使用可能
10.0
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { NSNumber *num = [NSNumber numberWithDouble:21474836.900000]; NSLog(@"%%f = %f",[num floatValue]); NSLog(@"%%e = %e",[num floatValue]); NSLog(@"%%g = %g",[num floatValue]); NSLog(@"-------------------------------"); NSNumber *num2 = [NSNumber numberWithDouble:1234.561]; NSLog(@"%%f = %f",[num2 floatValue]); NSLog(@"%%e = %e",[num2 floatValue]); NSLog(@"%%g = %g",[num2 floatValue]); NSLog(@"%d byte(s)",sizeof[num floatValue]); //テキストフィールドにセット [info setFloatValue:[num floatValue]]; } @end