mink23
mink23

Reputation: 154

Delete Single Separator in TableView

I am trying to delete a single separator in a tableView. I have annotated the screenshot below to show this. I am wanting to delete the first cells top separator. My top text & search bar is in the tableView's header. How would I achieve this?

enter image description here

Upvotes: 1

Views: 126

Answers (3)

kartik patel
kartik patel

Reputation: 536

tblView.separatorStyle = .none

Upvotes: 0

fazeel ahamed
fazeel ahamed

Reputation: 84

Add a separator view (UIView) as part of your Custom cell. From the nib make the separator for UITableView to none.

Upvotes: 0

Vivek
Vivek

Reputation: 5213

Please try with this code

Original answer for this code is @Avinash

For mode detail please check avinash answer

if indexPath.row == {your row number} {
    cell.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: .greatestFiniteMagnitude)
}

Upvotes: 1

Related Questions