解决cell分割线左边短20px:
/**
* 解决cell分割线左边短20px的问题
*/
- (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];
}
}
数据少时,隐藏多余的分割线:
//iOS隐藏tableview多余的分割线:
_tableView.tableFooterView = [[UIView alloc] init];