I believe this is the same question that I asked here:
[To see links please register here]
In **iOS 8**, there is one new property for all the objects inherit from `UIView`. So, the solution to set the `SeparatorInset` in iOS 7.x will not be able to remove the white space you see on the UITableView in iOS 8.
The new property is called "**layoutMargins**".
@property(nonatomic) UIEdgeInsets layoutMargins
Description The default spacing to use when laying out content in the view.
Availability iOS (8.0 and later)
Declared In UIView.h
Reference UIView Class Reference
![iOS 8 UITableView setSeparatorInset:UIEdgeInsetsZero setLayoutMargins:UIEdgeInsetsZero][1]
The solution:-
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
If you set `cell.layoutMargins = UIEdgeInsetsZero;` without checking if the `layoutMargins` exists, the app will crash on iOS 7.x. So, the best way would be checking if the `layoutMargins` exists first before `setLayoutMargins:UIEdgeInsetsZero`.
[1]: