1.在用tableView的时候有时候需要让cell下边的线充满整个cell,或者两边对其,或者去掉其中一行横线,用下边的方法即可:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) { //补全某行的下划线
[cell setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
} else if (indexPath.row == 1) { //两边对齐某行的下划线
[cell setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 15)];
} else if (indexPath.row == 2) { //删除某一行的下划线
[cell setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width)];
}
}
2.去掉tableView上面除了cell之外多余的线,用下面的方法就行:
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];