UITableViewCell height with 0 rows
- by Typeoneerror
I've got a moderately uncustomized UITableView in my application that presents an array of up to 6 peers for a networking game. When no peers are found the numberOfRowsInSection is 0, so when it loads up, there's no rows in the table:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 0;
}
Trouble is, the height of each cell is not adjusted to match heightForRowAtIndexPath unless the numberOfRowsInSection is 0. I hard-coded in "1" for this and the height is adjusted.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return kTableRowHeight;
}
Can anyone tell me why this is? Will once the data that is being presented is longer than "0" length, will the height of the table cells jump to the correct height? I'd like them to be the correct height even if the row length is 0.