Reputation: 928
I am using a UITableView
where i need to remove the
separator between first cell and HeaderView
of a UITableView
. Tried a some solution but nothing worked for me. Any kind of help will be appreciable. attaching screen shot of my current view and expected view
Upvotes: 0
Views: 154
Reputation: 41
You can use the following code:
Swift :
if indexPath.row == {your row number} {
cell.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: .greatestFiniteMagnitude)
}
or :
cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, UIScreen.main.bounds.width)
for default Margin:
cell.separatorInset = UIEdgeInsetsMake(0, tCell.layoutMargins.left, 0, 0)
to show separator end-to-end
cell.separatorInset = .zero
Objective-C:
if (indexPath.row == {your row number}) {
cell.separatorInset = UIEdgeInsetsMake(0.0f, 0.0f, 0.0f, CGFLOAT_MAX);
}
Upvotes: 0
Reputation: 4552
Separators are set per tableView, so it's not exactly possible to remove them just per cell.
However, if you set the tableview.separatorStyle = .none
, and create a fake separator as a view in your cell at the bottom of the cell, you can achieve the look you're after.
Upvotes: 1