指定 table 视图的分隔线宽度

specify the separator line width of the table view

table 视图中的默认分隔线不占用整个单元格的宽度。如何指定行分隔符宽度以占用 table 视图的整个宽度?

这是默认情况下的样子:

从单元格中删除所有边距设置。尝试将所有这些添加到

中的单元格
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

    // Remove insets in UITableViewCell separator

// Remove seperator inset
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
    cell.separatorInset = UIEdgeInsetsZero;
}

// Prevent the cell from inheriting the Table View's margin settings
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
    cell.preservesSuperviewLayoutMargins = NO;
}

// Explictly set cell's layout margins
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
    cell.layoutMargins = UIEdgeInsetsZero;
}