您的位置:首页 > 移动开发 > IOS开发

iOS - TableView 去掉多余行数以及最后一行Cell分割线的处理

2016-12-24 20:15 1946 查看

去掉多余行数

// 去掉底部多余的表格线
[tableView setTableFooterView:[[UIView alloc] initWithFrame:CGRectZero]];


最后一行Cell分割线

最后一行分隔线顶头显示

// 最后一行分隔线顶头显示
// http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-working static void setLastCellSeperatorToLeft(UITableViewCell* cell)
{
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}

if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}

if([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]){
[cell setPreservesSuperviewLayoutMargins:NO];
}
}


去掉最后一个cell的分割线

cell.separatorInset =UIEdgeInsetsMake(0,0, 0, cell.bounds.size.width-15);


隐藏最后一条分割线

UITableView 隐藏最后一条分割线–>footerView高度0.1)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios cell tableView