【发布时间】:2011-03-19 15:15:54
【问题描述】:
我正在设置我的身高:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat rowHeight = 0;
if(indexPath.row == [self.items count]){ //more
rowHeight = 50.0; //same as moreCell
}
else{
ChartlyCell *cell = (ChartlyCell*)[self tableView:tblView cellForRowAtIndexPath:indexPath];
rowHeight = cell.totalHeight;
}
return rowHeight;
}
cell.totalHeight 的计算方法如下:
-(float)totalHeight {
float h = messageLabel.totalheight + 35;
if(h < 68) h = 68;
return h;
}
当NSZombieEnabled = NO 时,我的模拟器在没有调试错误的情况下崩溃。 NSZombieEnabled = YES 时模拟器运行良好。不知道如何解决?
更新: 这就是我构建初始化单元格的方式:
cell = [[[ChartlyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier andDelegate:self andChartlyDelegate:self andChartlyObj:myChartlyObject]autorelease];
如果我删除自动释放,一切运行正常。我还是不明白为什么?
【问题讨论】:
标签: iphone objective-c cocoa-touch uitableview memory-management