6

I have been using the following code for tableview

 _comboBoxTableView = [[UITableView alloc] initWithFrame:CGRectMake(1, _selectContentLabel.frame.origin.y+_selectContentLabel.frame.size.height-1, frame.size.width+1, 48) style:UITableViewStylePlain];
_comboBoxTableView.layer.borderColor=[UIColor colorWithRed:226.0/255.0 green:226.0/255.0 blue:226.0/255.0 alpha:1].CGColor;
_comboBoxTableView.layer.cornerRadius = 10;
_comboBoxTableView.layer.borderWidth = 1.0f;
_comboBoxTableView.separatorColor = [UIColor colorWithRed:166.0/255.0 green:166.0/255.0 blue:166.0/255.0 alpha:1];
[_comboBoxTableView setSeparatorStyle:UITableViewCellSeparatorStyleSingleLine];

enter image description here There is an unwanted white color on the left of each separator as shown below.

Is it a bug? I am running it with ios7.1. Any work around ?

VARUN ISAC
  • 443
  • 3
  • 13

4 Answers4

1

It's not a bug. As of iOS 7, table views are capable of adjusting the insets of their separators. If you want an edge to edge separator, eliminate the insets:

if ([_comboBoxTableView respondsToSelector:@selector(separatorInset)]) { // In case running iOS < 7
    _comboBoxTableView.separatorInset = UIEdgeInsetsZero;
}

More info in the UITableView documentation.

Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
0

Just in case that you do not have time to fix this programatically, you can add subview patching the while line.

enter image description here

I do know that this not the properly solution, but works.

0

What worked for me: in Interface Builder, the tableview has a thing called Separator Inset. It's normally on Default (this seems to be 15).

You can switch it to Custom and replace the 15 with 0. No more weird lines.

enter image description here

enter image description here

Florin Odagiu
  • 456
  • 6
  • 16
0

In case if someone needs non-zero separator insets, those white lines are UITableCell which are not covered by the cell content view and separators. Just select UITableCell in the document outline (not the content view!) and set it the same background color as content view's background (or any color which you want).

Sash
  • 315
  • 3
  • 6