我有NNDictionary
,我想将其存储在另一个NSMutableDictionary
中。我是这样做的:
NSDictionary* dictionary = (NSDictionary*) [NSKeyedUnarchiver unarchiveObjectWithData:context];
[myDictionarySTORE setObject:dictionary forKey:[NSString stringWithFormat:@"%d", r]];
要提取它,我会这样做:
NSDictionary* dic = [myDictionarySTORE objectForKey:[NSString stringWithFormat:@"%ld", (long)btn.tag]];
NSString *Name = [dic objectForKey:@"fileName"];
NSString *Type = [dic objectForKey:@"fileType"];
NSData *File = [dic objectForKey:@"FileData"];
这种情况下的btn.tag是r。键是相同的,但它似乎不起作用......
答案 0 :(得分:-1)
NSDictionary * dic = [NSDictionary dictionaryWithDictionary:[myDictionarySTORE objectForKey:[NSString stringWithFormat:@“%ld”,(long)btn.tag]]];
或者
NSDictionary * dic = [[NSDictionary alloc] initWithDictionary:[myDictionarySTORE objectForKey:[NSString stringWithFormat:@“%ld”,(long)btn.tag]]];