Reputation: 1082
I'm searching too many questions related to increasing height of UITableViewCells
but I can't get exactly what I want.
I have to calculate dynamic height of UITableViewCell
. But, problem is in my cell there is a dynamic number of buttons, ranging from 1 to 100. I don't know how many buttons will show beforehand. So how can we calculate the height?
Upvotes: 1
Views: 187
Reputation: 5343
One way you could do is that you can have a global variable, for ex: cellHeight, and then change the cellHeight dynamically when you are customising your cell.
finally, return the cellHeight
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return cellHeight;
}`
Upvotes: 1
Reputation: 47089
There are Two Way for get size of UITableViewCell
1) cell.bounds.size.height
2) cell.contentView.frame.size.height
It depending on which you actually need.
Upvotes: 0