I have an editable textview inside a tableviewcell, like the field notes in apple contacts, but the tableviewcell doesn't resize with the textview. I think that the problem is in this method. Can anybody help me?
- (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;
}
}
This is the best example for the editable Cell as per your requirement. UITableViewCell that automatically adjusts its height as you enter text and you can managed it easily.