Ios 拆卸节段集管和;uitableviewcell

Ios 拆卸节段集管和;uitableviewcell,ios,uitableview,Ios,Uitableview,如何删除图中所示的线条?我尝试过以下建议,但没有一个对我有效 这是我在cellForRowAt中的当前代码: if (indexPath.row == place_sections[indexPath.section].rows.count - 1) { cell.separatorInset.left = 1000 //cell.layer.borderWidth = 0 //cell.separato

如何删除图中所示的线条?我尝试过以下建议,但没有一个对我有效

这是我在
cellForRowAt
中的当前代码:

       if (indexPath.row == place_sections[indexPath.section].rows.count - 1) {
            cell.separatorInset.left = 1000
            //cell.layer.borderWidth = 0
            //cell.separatorInset = UIEdgeInsetsMake(0, 160, 0, 160);

        }
        if (indexPath.row == 0) {
            cell.separatorInset.left = 1000
            //cell.layer.borderWidth = 0
            //cell.separatorInset = UIEdgeInsetsMake(0, 160, 0, 160);

            //                self.tableview.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: self.tableview.frame.width, height: 1))
        }
多谢各位


这是objective c代码,它可以帮助您

对于swift和objective c

第一个链接具有自定义标题视图,因此边界线不会出现在这里

在viewForHeaderInSection函数中注释此代码

// /********** Add a custom Separator with Section view *******************/
//    UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(15, 40, _expandableTableView.frame.size.width-15, 1)];
//    separatorLineView.backgroundColor = [UIColor blackColor];
//    [sectionView addSubview:separatorLineView];
看到屏幕截图了吗
我能解决这个问题的最接近的方法是将UITableView的样式从“分组”更改为“普通”

如果你能找到一个更好的解决方案,我不建议你这么做,因为现在滚动时节头会粘在屏幕顶部,这是不可取的(我认为正确的描述方法是“节头浮动”)


标题和单元格之间的分隔符属于节中的第一个单元格。 当我使用标准的
UITableViewHeaderFooterView
UITableViewCell
时,我通过以下代码隐藏了标题和单元格之间的行:

let contentView = cell.contentView
if
    // this separator is subview of first UITableViewCell in section
    indexPath.row == 0,
    // truing to find it in subviews
    let divider = cell.subviews.filter({ $0.frame.minY == 0 && $0 !== contentView }).first
{
    divider.isHidden = true
}

这段代码必须在
tableView(\utableview:UITableView,willDisplay cell:UITableView cell,forRowAt indexPath:indexPath)中调用。

您是否尝试过设置
tableView.separatorColor=tableView.backgroundColor
?它不会删除分隔符,但应该可以,因为您只想看到结果。请阅读下面第一个答案的注释。这不是我想要的。@marko calvocruz我理解你的问题,我会努力解决它……问题是我想保留行与行之间的分隔符。我只是不喜欢(最后一行&节头)和(节头&第一行)之间的分隔符。@iOSDeveloper他想保留单元格之间的分隔符。不是单元格和部分标题之间的分隔符。在检查完这两个链接后,这两个链接都不能真正帮助我解决问题。此解决方案不仅从标题中删除分隔符,而且从每个部分的最后一个单元格中删除分隔符。就用户体验而言,这是不一致的行为,我想这也不是问题中所期望的。