How do I remove the lines indicated in the picture? I have tried the following suggestions and none of them have worked for me,
How do I remove the borders of a UITableView?
Remove separator line for only one cell
Hide separator line on one UITableViewCell
This is my current code in 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))
}
Thank you
Separator between header and cell belongs to first cell in section.
When I used standard UITableViewHeaderFooterView
and UITableViewCell
I managed to hide line between header and cell via this code:
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
}
This piece of code must be invoked in tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With