Reputation: 8988
I'm having a UITableViewController
with two sections. Section 0 always contains 1 row with height 22px. I'm setting this with heightForRowAtIndexPath
... Section 1 contains 0-n rows with height 44px. I'm also setting the height of these with heightForRowAtIndexPath
.
The problem is that when I have no rows in section 1, all the "fill out cells" will have height 22px, like the cell in section 0, instead of 44px as I would like them to be.
Is it possible to set the height of these fill out cells to 44px (the cells that are empty and added automatically to fill out the table view) even if I only have the one row that is 22px?
Here is what I get (to the left) and what I want (to the right):
Upvotes: 1
Views: 672
Reputation: 325
I'm having the same problem here. Two sections, the first shows 3 cells with a smaller height and always with the same content and they should scroll with the table so they can't be a header. The rows below with a larger cell height are changing so sometimes there are none.
I adjusted the cell height of the tableView as well as for the prototype cells and assign the heightForRowAtIndexPath
value properly, but this doesn't help. Somehow the tableView seems to repeat the cells from first section into the second one if there are no cells in the later.
Only solution so far seems to be the creation of an empty cell in the second section. That's just more complicated if you are using animated cells.
Upvotes: 0
Reputation: 857
Instead of making your "status bar" its own section, you could make it a header view for section 1.
Upvotes: 1
Reputation: 14314
Try editing the UITableView attributes in the XIB - you can set a default row height so that if otherwise stated, all these "fill out" cells are defaulted to 44px height. You say that the 22px cell is there anyway so I think it should do as a solution to your problem.
Upvotes: 1