Like the Objective-C example, but converted to fast. I had some problems. This code works in a UITableView, if you do this in a UITableViewController, you replace self.tableView for yourself:
// iOS 7 if(self.respondsToSelector(Selector("setSeparatorInset:"))){ self.separatorInset = UIEdgeInsetsZero } // iOS 8 if(self.respondsToSelector(Selector("setLayoutMargins:"))){ self.layoutMargins = UIEdgeInsetsZero; }
And for the cell (iOS 8 only), enter the code below in the following function:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
get the cell and set the following property:
// iOS 8 if(cell.respondsToSelector(Selector("setLayoutMargins:"))){ cell.layoutMargins = UIEdgeInsetsZero; }
Kendrick taylor
source share