これは私にナッツを動かしている - 私は私の心を失っていないことを教えてください!NSDictionary setValue:
は私が宣言:
NSMutableDictionary* generalSettingsDict;
イム私の.h
私はINIT:viewWillAppear
で
generalSettingsDict = [[NSMutableDictionary alloc] initWithCapacity:5];
私が設定:
[generalSettingsDict setValue:[NSNumber numberWithBool:control.on]
forkey:[NSNumber numberWithInt:control.tag]];
この方法で0
:
-(void)settingChanged:(UISwitch*)control forEvent:(UIEvent *)event
そして私は"NSMutableDictionaryは、setValueのに応答しない場合がありますforkey:" GETとアプリがクラッシュし、それが実行されたとき。
:(
です。forKey :, forkey:はありません。レコードの場合、 'NSMutableDictionary'は' setValue:forKey: 'をサポートしていますが、' setObject:forKey: 'を使うのが好きです。 – Alex