我正在试图制作一个可以单击的单元格表格,然后逐渐增大以显示所有信息。这工作到如下代码使用didSelectRowAtIndexPath缩回表格视图单元格
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
// Note: Some operations like calling [tableView cellForRowAtIndexPath:indexPath]
// will call heightForRow and thus create a stack overflow
if(selectedCellIndexPath != nil
&& [selectedCellIndexPath compare:indexPath] == NSOrderedSame){
labelSize = [[items objectAtIndex:indexPath.row] sizeWithFont:[UIFont fontWithName:@"Helvetica" size:13.0]
constrainedToSize:CGSizeMake(220.0f, MAXFLOAT)
lineBreakMode:UILineBreakModeWordWrap];
return labelSize.height + 40;
}
return 68;
}
这工作正常,使细胞更大。但是没有办法关闭电池。我试过阅读,在这种情况下,labelSize.heigth,但这不符合单击单元格的实际高度。
有没有人知道关闭单元格的好方法,换句话说,当细胞被第二次敲击时需要设置68的高度。
谢谢!