某處的ARC項目,我有:力的NSDictionary釋放內存
//Class1.h
@interface Class1 {
NSDictionary * dict;
}
@end
//Class1.m
@implementation Class1
-(void)loadDict {
NSDictionary * dict = [[NSDictionary alloc] init];
// Now load couple of (NSString *, NSString *) pairs into the dictionary
...
}
-(void)releaseAllMemoryUsedByDict {
//TODO
}
@end
如何釋放被佔用的字典中的所有記憶,需求?我猜如果我有一個NSMutableDictionary,我可以調用它的removeAllObjects方法。我如何做NSDictionary?會設置字典= NULL工作?
將它設置爲零將完成這項工作。如果它仍然不工作撕裂字典的所有頁面:) – Matt