隐藏多余的分割线
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;
}
}
}
本文介绍如何在iOS应用中使用Swift调整UITableView的cell分割线样式,包括隐藏多余分割线、设置分割线长度及解决footerView存在时最后一个cell分割线不显示的问题。
438

被折叠的 条评论
为什么被折叠?



