我有一个这样的方法
- (NSDictionary *)getCellValuesForRow:(int)row {
NSMutableDictionary *dictValues= [[NSMutableDictionary alloc] init];
Outage *outage = [listOutage objectAtIndex:row];
[dictValues setObject:outage.duration forKey:@"OutageDuration"];
return dictValues;
}
并且这个值是这样存储的
NSDictionary *dict = [[NSDictionary alloc] initWithDictionary:[self getCellValuesForRow:(indexPath.row-1)]];
这种情况下如何释放内存
最佳答案
这就是autorelease
的用途。
NSMutableDictionary *dictValues= [[[NSMutableDictionary alloc] init] autorelease];
关于iphone这种情况下如何释放内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5759708/