Andrew Andrew - 4 months ago 28
Objective-C Question

Hiding UITableViewCell separator for individual cells

I require a UITableViewCell separator for the majority of my cells, but some of them should be hidden.

The way this is set is

self.tableView.separatorStyle
, which would apply to every cell.

A heavy-handed work around is to disable it, and then draw it onto cells manually as a UIView, but I don't want to go there.

How can I otherwise remove the separator for individual cells?

Answer

You can have custom cell and add separator in this cell, this way you can manage your cell separator. Or you can addSubView a UIView for separator to your cell like iPatel's answer, but be careful for memory issue.