So I have a UITableView with a custom background and a grey UITableViewSeparatorColor. By default, my table shows separator lines even if there are no cells. I do not want this, I want it to be completely blank and only show separator lines between cells, but the background.
I got this working by using
Code:
self.routineTableView.separatorColor = [UIColor grayColor];
when there are cells, the line shows just for those cells and not the background.
But when there are no cells (such as before a user adds cells), the lines are present.
I tried doing something like this:
Code:
if ([[self.fetchedResultsController fetchedObjects] count] == 0)
{
self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
else
{
self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
self.routineTableView.separatorColor = [UIColor grayColor];
}
but it just removes the line for the cells and the background.. Any ideas?
This pic shows that there are separator lines when the table is blank for all cells:
And this pic shows that when there are cells, the separator line is shown only for the cells, and not the background