Is there a way to make UITableView cells in iOS 7 not have a line break in the separator?

Solution 1:

For iOS7:

if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [self.tableView setSeparatorInset:UIEdgeInsetsZero];
}

For iOS8:

First configure your table view as follows:

if ([self.tableView respondsToSelector:@selector(layoutMargins)]) {
    self.tableView.layoutMargins = UIEdgeInsetsZero;
}

Then in your cellForRowAtIndexPath: method, configure the cell as follows:

if ([cell respondsToSelector:@selector(layoutMargins)]) {
    cell.layoutMargins = UIEdgeInsetsZero;
}

Note: Include both layoutMargins and separatorInset, to support both iOS versions

Solution 2:

You can also set the 'Separator Inset' from the storyboard:

enter image description here

enter image description here

Solution 3:

If you want to support older versions of iOS, you should check for the availability of this method before calling it:

if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
    [self.tableView setSeparatorInset:UIEdgeInsetsZero];
}