I am working on an application that uploads user posts on facebook. All this information is placed in a table. Cells are consumed when you click on them. So far, it has only text. I calculate the height of the text, so I know how tall the cell should be when expanding.
The problem I am facing is that there should be more to it than just text. If the user sends the video to facebook, the video will also be embedded in the cell. But since height is calculated based on text, it leaves no room for embedded video. I can add a marker to the cell, but this margin will be applied to the cell.
This is the code I'm using right now:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tableView reloadData];
[self stopLoading];
if (selectedIndexPath == indexPath)
{
selectedIndexPath = nil;
}
else
{
selectedIndexPath = indexPath;
}
[self.tableView deselectRowAtIndexPath : indexPath animated : YES];
[tableView beginUpdates];
[tableView endUpdates];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ((selectedIndexPath != nil) && (selectedIndexPath.row == indexPath.row))
{
labelSize = [[result2 objectAtIndex:indexPath.row] sizeWithFont:[UIFont fontWithName:@"Helvetica" size:13.0]
constrainedToSize:CGSizeMake(220.0f, MAXFLOAT)
lineBreakMode:UILineBreakModeWordWrap];
return labelSize.height + 136;
}
return 68.0;
}
. ? .
, - !
Thnx