扩展UITableViewCell

我正在试图展开一个UITableViewCell来显示更多的内容。 到目前为止我已经得到了animation,但我的问题是新的内容出现在animation完成之前。 这是我的代码:

ps描述标签和读取button都在单元configuration后隐藏起来。

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { self.selectedRow = indexPath; SDJCell *cell = (SDJCell *)[tableView cellForRowAtIndexPath:indexPath]; [tableView beginUpdates]; [tableView endUpdates]; cell.descriptionLabel.hidden = NO; cell.readButton.hidden = NO; } -(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { SDJCell *cell = (SDJCell *)[tableView cellForRowAtIndexPath:indexPath]; [tableView beginUpdates]; [tableView endUpdates]; cell.descriptionLabel.hidden = YES; cell.readButton.hidden = YES; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if(selectedRow && indexPath.row == selectedRow.row) { return 100; } return 44; } 

任何想法如何我可以透露这个额外的内容后,细胞扩大??

谢谢!!

我有同样的问题。 解决方法是设置单元格的自动resize的掩码,以便随着其超级视图resize。

 cell.autoresizingMask = UIViewAutoresizingFlexibleHeight; cell.clipsToBounds = YES; 

你也可以在sotoryboard中做到这一点,这两个标志可以在身份检查员下设置