Having an empty iOS tableview look (but when filled this changes)?

Hi I am attempting to create a rectangular region (tableView), that when it has no cells will be just a background color. Then when it has cells, the cell background can be different and separators become visible. This idea can be seen in http://itunes.apple.com/us/app/spendings/id473857206?mt=8 in the second screen shot. I can come close by just setting the background color of the table and the cells to different colors, but when there are no cells the table collapses. The screenshot in that link doesn't show this, but when there are no items, it is just an empty rectangle. How can one maintain the dimensions of the table, even when there are no cells?


You can try setting the separator color to clearColor so that the cells aren't visible when they're empty, like:

if([tableView numberOfRowsInSection:0]==0)
    tableView.separatorColor = [UIColor clearColor];

Need Your Help

Call a method from a super class

objective-c ios

Couldn't i? i need to call a method from class A, this method is in class B which inherit from class A.

How to get css handle for text inside element without elements child

java jquery html coffeescript

If we use tbody tr th, it gives text 'Display model Sample Heading', including its child element (div) text.