我有这个UITableView应用程序,一个基本的日记应用程序,在这个方法XCode说我有内存泄漏。建议首先泄漏的第一行是117“NSString * CellIdentifier”。 下来如果(细胞== ...,日记* diaryEntry,NSString *字符串日期。 那里它说明方法返回一个+1保留计数拥有的对象 我试图释放单元格, stringDate ...什么都没有改变这个事实,所以我在想什么/做错了什么?不知道为什么这是内存泄漏,请指教!
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// A date formatter for the time stamp static
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
Diary *diaryEntry = [diaryArray objectAtIndex:indexPath.row];
cell.textLabel.text = diaryEntry.diaryTitle;
NSString *stringDate = [[DiaryDateFormatter alloc] convertDateToString:[diaryEntry diaryDate]];
cell.detailTextLabel.text = stringDate;
[stringDate release];
return cell;
}
我终于弄清楚了,到了它觉得这样的年龄。但是现在我已经杀死了那个covertDateToSting的东西。刚刚造成了问题。在那之后问题解决了。 – 2010-08-11 06:09:10