I have a question about UITableView... I have a UITableViewController and I created a custom cell. When I visualize the tableView I see a little white space before the separ
Here is an extension to UITableViewCell Class for swift 3 & later
extension UITableViewCell
{
func removeSeparatorLeftPadding() -> Void
{
if self.responds(to: #selector(setter: separatorInset)) // Safety check
{
self.separatorInset = UIEdgeInsets.zero
}
if self.responds(to: #selector(setter: layoutMargins)) // Safety check
{
self.layoutMargins = UIEdgeInsets.zero
}
}
}
Usage:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell : UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "menuCellID")!
// .. Your other code
cell.removeSeparatorLeftPadding()
return cell
}
Hope this helps some one!
Naresh.