我在textview单元格中有一个可编辑的textview,就像苹果通讯录中的字段注释一样,但是textview单元格不会随着textview调整大小。我认为问题出在这个方法上。有人能帮我吗?
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0 && indexPath.row == 0)
{
if (self.textView.contentSize.height >= 44)
{
float height = [self heightForTextView:self.textView containingString:self.model];
return height + 8; // a little extra padding is needed
}
else
{
return self.tableView.rowHeight;
}
}
else
{
return self.tableView.rowHeight;
}
}发布于 2013-06-04 17:29:52
根据您的要求,这是可编辑单元格的最佳示例。UITableViewCell可以在您输入文本时自动调整高度,您可以轻松地对其进行管理。
https://stackoverflow.com/questions/16913890
复制相似问题