I have got a UITableView in my ViewController and it’s row has custom content. Every cell’s height dynamically calculated according to cell’s content with - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath method.
But how can set UITableView’s height?
Because if my table contains only one row, after row i see a big whitespace in my table?
Isn’t there any property to set table’s height dynamically increase or reduce according to its contents?
The
contentSizewill be adjusted as needed by the number of rows and sections you have, if you want to change the actual size of the table view you should adjust theframepropertyyou might just be better off putting a backgroundView or colour on the table if its that the white background when you only have a few rows is bothering you