每行分隔符上的UITableView不需要的白线

VAR*_*SAC 6 objective-c uitableview ipad ios ios7.1

我一直在使用以下代码进行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];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 每个分隔符左侧都有不需要的白色,如下所示.

这是一个错误吗?我用ios7.1运行它.有什么工作吗?

Mic*_*lum 1

这不是一个错误。从 iOS 7 开始,表格视图能够调整其分隔符的插入量。如果您想要边到边分隔符,请消除插图:

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

更多信息请参见UITableView 文档