設定 tableView的倆個屬性:
_tableView.layoutMargins = UIEdgeInsetsZero;
_tableView.separatorInset = UIEdgeInsetsZero;
在 cell 即将顯示的時候,設定 cell 的屬性(tableView 的代理方法)
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.separatorInset = UIEdgeInsetsZero;
cell.layoutMargins = UIEdgeInsetsZero;
}
運作,OK