隐藏多余的分割线
self.tableView.tableFooterView = [[UIView alloc] init];
cell分割线左右各短15px
/**
* cell分割线左右各短15px
*/
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.separatorInset = UIEdgeInsetsMake(0, 15, 0, 15);
}
解决UITableView有footerView时最后一个cell不显示分割线问题
//重写layoutSubViews方法(显示分割线)
- (void)layoutSubviews {
[super layoutSubviews];
for (UIView *subview in self.contentView.superview.subviews) {
if ([NSStringFromClass(subview.class) hasSuffix:@"SeparatorView"]) {
subview.hidden = NO;
}
}
}