I have a custom table view cell in my table view controller. On my cell there is a label which i want to either show/hide based on the row information. I can easily show/hide the label based on the row information. But is it possible to expand or collapse the height of the tableview cell based on whether that label is present or not? I expect just one row of data for that label.
Best How To :
Attach a UITableViewDelegate to your UITableView's delegate. And implement the above method and set the height depending on if the cell is collapsed or expanded.
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
return (indexPath.row == _rowIndexWithLabel) ? tableView.rowHeight + _heightOfLabel : tableView.rowHeight;