Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ccabanero/d2de65dba2ffe04cf47e to your computer and use it in GitHub Desktop.

Select an option

Save ccabanero/d2de65dba2ffe04cf47e to your computer and use it in GitHub Desktop.
iOS: Remove UITableViewCell separator line indentation
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
// for removing the leading margin of the tableview cell's separator line (i.e. the separator is drawn across the entire screen)
if (tableView.respondsToSelector("setSeparatorInset:")) {
tableView.separatorInset = UIEdgeInsetsZero
}
if (tableView.respondsToSelector("setLayoutMargins:")) {
tableView.layoutMargins = UIEdgeInsetsZero
}
if (cell.respondsToSelector("setLayoutMargins:")) {
cell.layoutMargins = UIEdgeInsetsZero
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment