How to fix UITableView separator on iOS 7?

IphoneIosIpadUitableviewIos7

Iphone Problem Overview


UITableView draws with ragged lines on iOS 7:

enter image description here

How to fix it? The line between cells should be on the full width of the screen.

Iphone Solutions


Solution 1 - Iphone

UITableView has a property separatorInset. You can use that to set the insets of the table view separators to zero to let them span the full width of the screen.

[tableView setSeparatorInset:UIEdgeInsetsZero];

Note: If your app is also targeting other iOS versions, you should check for the availability of this property before calling it by doing something like this:

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

Solution 2 - Iphone

This is default by iOS7 design. try to do the below:

[tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];

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

enter image description here

enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDmitryView Question on Stackoverflow
Solution 1 - Iphones1m0nView Answer on Stackoverflow
Solution 2 - IphoneTarek HallakView Answer on Stackoverflow