Search code examples
iosuitableviewios8separator

UITableViewCell cannot remove insets


I have gone through every single solution I could find in regards to removeing the inset on the left hand side of the border. This is the code I have applied and the apple documentation has said that this is the property I should apply it to.

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("voicemailCell", forIndexPath: indexPath) as! UITableViewCell

    // Configure the cell...
    cell.separatorInset = UIEdgeInsetsZero
    return cell
}

I have no idea why this isnt working my only reasoning is that I shouldnt be applying it to the cell there but surely the let cell is referencing the cell.


Solution

  • You can simply edit this setting in storyboard. Select your tableView -> Go to inspector and then set Content Inset to custom. Default padding is 15 - Set it to 0

    and test this in real device. It should work.

    If nothing works for you try adding a view at the bottom of cell with height=1 and hide the default separator.