boolForKey:
ユーザーデフォルトからキーでBOOL値を取り出します
-(BOOL)boolForKey:(NSString *)defaultName:
解説
ユーザーデフォルトからキー(defaultName)でBOOL値を取り出します。
返り値
( BOOL )
取り出せたかYES/NO
引数
( NSString * )defaultName
取り出すキー
フレームワーク
Foundation
クラス
NSUserDefaults
Instance Methods
使用可能
10.0
参照
- arrayForKey:
- dataForKey:
- dictionaryForKey:
-floatForKey:
-integerForKey:
-objectForKey:
-stringArrayForKey:
-stringForKey:
例文
#import "SetImage.h" @implementation SetImage - (IBAction)set:(id)sender { BOOL boo1 = YES; BOOL boo2 ; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setBool : boo1 forKey : @"settei1"]; boo2 = [defaults boolForKey:@"settei1"]; if(boo2){ NSLog(@"YES"); }else{ NSLog(@"NO"); } } @end