一般设置cell时使用
cell.separatorInset = UIEdgeInsetsMake(top, left, bottom, right);
但此方法不能使分割线对齐屏幕最左边
在tableView代理中设置可以是分割线左对齐
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsZero]; } if ([cell respondsToSelector:@selector(setLayoutMargins:)]) { [cell setLayoutMargins:UIEdgeInsetsZero]; } if([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){ [cell setPreservesSuperviewLayoutMargins:NO]; } }