iOS Uitableviewcell分隔符看起来很奇怪

时间:2014-04-25 05:37:00

标签: iphone objective-c uitableview ios7.1

我在UITabelViewController中使用iOS 7.1和静态单元格。我在storyboard中看到了所需的分隔符,但在simulator中没有。这让我很疯狂。

故事板截图

enter image description here

模拟器截图

enter image description here

我不希望separator inset之前有额外的白线。但我仍然需要分隔符,就像它在Storyboard屏幕截图中显示的那样。如何删除额外的白线?任何帮助,将不胜感激。

我为tableView背景设置了黑色。仍然没有改善。单元格是静态的,是自定义单元格。

3 个答案:

答案 0 :(得分:1)

感谢此处的其他答案。我发现了导致这个错误的原因。

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

这是在iOS 7版本中描述的错误。 https://stackoverflow.com/a/18878259/1083859

答案 1 :(得分:0)

试试这个

if ([YourTableView respondsToSelector:@selector(setSeparatorInset:)]) {
            [YourTableView setSeparatorInset:UIEdgeInsetsZero];
        }

答案 2 :(得分:0)

请将表格视图的seperatorinset设置为零。enter image description here

相关问题