0

I am using UITabelViewController and static cells in iOS 7.1. I am seeing desired separator in the storyboard, but not in the simulator. This drives me crazy.

Storyboard Screenshot

enter image description here

Simulator Screenshot

enter image description here

I don't want the extra white line before the separator inset. But I still need the separator just like the way it is showing in Storyboard Screenshot. How to remove that extra white line? Any help would be appreciated.

I set the black color for tableView background. Still no improvement. Cells are static and are custom cells.

Dinesh Raja
  • 8,501
  • 5
  • 42
  • 81
  • Do you mean that you want remove the separator line ? Try it `_tableView.separatorStyle = UITableViewCellSeparatorStyleNone ;` – KudoCC Apr 25 '14 at 05:44
  • Desired output is Storyboard screenshot.. – Dinesh Raja Apr 25 '14 at 05:46
  • Have you set the separator color ? – KudoCC Apr 25 '14 at 05:48
  • Without setting the color, how can I see the color in storyboard? could you please see the screenshots well? – Dinesh Raja Apr 25 '14 at 05:49
  • Yes, I can see the screenshots. I wonder why the separator color in Storyboard Screenshot is not the default color if you didn't set it ? Is it your background image ? – KudoCC Apr 25 '14 at 05:54
  • Hey @KudoCC, Yes. I set the separator color to a golden color. So it is showing color. It is UITableViewController. You cannot set the background image for a tableviewcontroller especially in storyboard. Is that clear? – Dinesh Raja Apr 25 '14 at 05:56
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/51393/discussion-between-kudocc-and-dinesh-raja) – KudoCC Apr 25 '14 at 06:02

3 Answers3

1

Thanks for other answers here. I found out what causes the bug.

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    [cell setBackgroundColor:[UIColor clearColor]];
}

Here it is the bug described which is in iOS 7 versions. https://stackoverflow.com/a/18878259/1083859

Community
  • 1
  • 1
Dinesh Raja
  • 8,501
  • 5
  • 42
  • 81
0

Try this

if ([YourTableView respondsToSelector:@selector(setSeparatorInset:)]) {
            [YourTableView setSeparatorInset:UIEdgeInsetsZero];
        }
svrushal
  • 1,612
  • 14
  • 25
  • Why do I need to set the inset to 0? I need the inset to be 30. But I just don't need the extra white line only. – Dinesh Raja Apr 25 '14 at 05:43
0

Please set the seperatorinset for table view to zero.enter image description here

Nikhila Mohan
  • 2,000
  • 2
  • 15
  • 19