Reputation: 13
I set separator insets to 0 in my storyboard but when I runs the code, the inset is not 0 . Is it the bug of iOS? Is it any workaround here? (I'm new in iOS development)
Upvotes: 0
Views: 100
Reputation: 5418
Add the willDisplayCell
function of UITableViewDelegate
to your code and set the separatorInset
and layoutMargins
of your cell:
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.separatorInset = UIEdgeInsetsZero
cell.layoutMargins = UIEdgeInsetsZero
}
Upvotes: 3