在viewDidload 加下面代码
if ([self.table respondsToSelector:@selector(setSeparatorInset:)]) {
[self.table setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.table respondsToSelector:@selector(setLayoutMargins:)]) {
[self.table setLayoutMargins:UIEdgeInsetsZero];
}
实现方法
- (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];
}
}