如何去除图片中指示的线条?我尝试了以下建议,但没有一个对我有用,
How do I remove the borders of a UITableView?
Remove separator line for only one cell
Hide separator line on one UITableViewCell
这是我当前在 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))
}
谢谢
最佳答案
标题和单元格之间的分隔符属于节中的第一个单元格。
当我使用标准的 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(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
关于ios - 删除节标题和 uitableviewcell 之间的分隔符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48199381/