initWithBool:
BOOLの数値オブジェクトを初期化して返します
-(id)initWithBool:(BOOL)value:
解説
BOOLの数値オブジェクト(NSNumber)を初期化して返します。
返り値
( id )
NSNumber
引数
( BOOL )value
YES/NO値
フレームワーク
Foundation
クラス
NSNumber
Instance Methods
使用可能
10.0
参照
例文
#import "MyObject.h" @implementation MyObject - (IBAction)myAction:(id)sender { //BOOLの数値オブジェクトを作成 NSNumber *num = [[[NSNumber alloc] initWithBool:YES] autorelease]; //numをBOOL値として取り出す if ([num boolValue]){ NSLog(@"YES"); }else{ NSLog(@"NO"); } } @end