I'm implementing a static TableView which has two sections in Swift. I want to have the same effect as UITableViewCellSeparatorStyle.None in only section 0, while remaining the separator in the other section. Since it is a static TableView, I cannot configure the cell in cellForRowAtIndexPath function (which always get a cell value nil). I tried to make some IBOutlet for each of the static cells and configure their seperatorInset and layoutMargins property, however it just doesn't work. So I would like to know if there are other ways to remove the separators? Thanks!
First add effect UITableViewCellSeparatorStyle.None To the tableView. After that you can add a small view in your cell Which looks like the separator. Then give the connection to the separator View with the cell.after that the only thing you have to do in the cellForRowAtIndexPath is
if(indexPath.section == 0) {
seperatorView.hidden = false
} else {
seperatorView.hidden = true
}
This is a small trick to solve your Problem. Hope it helps
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