I have a UITableView where the separators don\'t have the full width. It ends like 10 pixels before the left side. I was playing around with this code in the
I inherit from UITableViewController and needed additional to the two insets settings in willDisplayCell also to set preservesSuperviewLayoutMargins to false. In Swift it looks like this:
override func tableView(_tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if cell.respondsToSelector("setSeparatorInset:") {
cell.separatorInset = UIEdgeInsetsZero
}
if cell.respondsToSelector("setLayoutMargins:") {
cell.layoutMargins = UIEdgeInsetsZero
}
if cell.respondsToSelector("setPreservesSuperviewLayoutMargins:") {
cell.preservesSuperviewLayoutMargins = false
}
}