views:

235

answers:

2

I am loading a content into UITableView dynamically. If there is data the table needs to display the data. If there is no data the table should display a plain page. But in my application the table displays the plain page with two separator lines. i need to remove this separator line and display a plain white page. Please Suggest?

Any help would be appreciated!

+1  A: 

You could check for the empty case if your datasource is empty add a placeholder view on top of the tableview. If they are not empty, remove the placeholder view.

klaaspieter
Sounds like an ugly hack to me, and ugly hacks tend to break real functionality down the road.
PeyloW
I believe vice versa: there should be "something" to explain user that application is working as planned, it did not crash, it did already finish what it was doing and - most importantly - this space is empty on purpose, but only for now.
JOM
I don't see why this is an ugly hack, it's just a way of displaying a custom view while there is no data. The custom view can explain why there is no data and how the user can enter data. It's a common practice in iPhone (and Mac) applications.
klaaspieter
+1  A: 

A plain UITableView will always display separator lines even if it is empty. You might notice that if you have a list with only one or two rows, there are still separator lines visible. This is the default behaviour and should not be overridden unless you have a really good reason.

I am guessing you see only two separator lines because your rows are very tall?

If you do really need to remove the separator lines then set the separatorStyle property on your table view to UITableViewCellSeparatorStyleNone. Take note that this will affect all rows. So if you still want separators for the rows that do exists, then you must draw these separator lines in your own UITableViewCell objects.

PeyloW
So you're saying that if someone really, really wants to have completely empty white tableview, the cell height should be set as high as the table itself? Sounds like it should work, if someone really wanted to do something like that...
JOM