views:

76

answers:

2

alt text

I have a UITableView within a nib file. It works perfectly with 4 or more cells. When I have only 2 or 3 cells and the screen is not completely filled with cells I have these empty cells (dark gray, which is actually just the background of my TableView) at the bottom.

However, they shouldn't be there, because my numberOfSectionsInTableView and numberOfRowsInSection returns the correct values.

Any ideas?

+1  A: 

I've seen that too. I guess if you don't like it then when you have only 2 or 3 cells, make a 3rd (or 4th) which is blank and non selectable to cover the remainder of the space.

Andiih
That's an option. But I was hoping that there is a simple setting which I could change. I don't even understand why it is there. For me this "feature" doesn't make sense at all.
znq
I don't think there is - I think Matt and I have covered the bases :-( I'm going to +1 for Matt - I think the "cleanest" solution would be to follow Matt's guidline then work the separator into your cell design. However, that might give you a last cell or first cell issue (showing a spare separator). But that is still going to be better/easier to solve that than add extra dummy cells as I suggested.
Andiih
+2  A: 

I don't think they are actually cells. You are seeing the white lines because this is the default behavior for the table view. Have you tried changing the separator for the table view to none in IB?

alt text

Matt Long
That does it, but then all separators are gone, which doesn't really work for my design. Thanks for your suggestion, though.
znq
I ended up resizing the UITableView every time the data changes. When smaller than screen size I set it to the actual size and when bigger than screen size I set it to screen size and can scroll down.
znq