-1

I have a custom table view cell with a label and a button, but for some reason the separator line under the custom cells on the right side is cut off. I checked the Custom Separator Inset in the Storyboard and it's 15 on the left, and 0 on the right. I even tried to set the Inset programmatically using tableView.layoutMargins = UIEdgeInsetsZero and cell.layoutMargins = UIEdgeInsetsZero, but that didn't work either. And suggestions are greatly appreciated. Thanks.

[See picture][1]

Update- Solved: So I made the custom cells in the storyboard using an iPhone 5 size screen and the simulate was an iPhone 6 so I guess the cell width wasn't long enough.

Ben
  • 29
  • 5

1 Answers1

0

Put this code in your table view's data source. I personally use this code and this will work whatever your storyboard settings are.

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath)
{
    if tableView.respondsToSelector(Selector("setSeparatorInset:")) { tableView.separatorInset = UIEdgeInsetsZero }
    if tableView.respondsToSelector(Selector("setLayoutMargins:")) { tableView.layoutMargins = UIEdgeInsetsZero }
    if cell.respondsToSelector(Selector("setLayoutMargins:")) { cell.layoutMargins = UIEdgeInsetsZero }
}
Jason Nam
  • 2,011
  • 2
  • 13
  • 22
  • Added that to the MyFriendsTableViewController.swift and the tableView still looks like the picture I posted! I'm thinking I might have to edit the customcell file – Ben Dec 26 '15 at 06:35