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

来源:互联网 发布:电脑的网络有个感叹号 编辑:程序博客网 时间:2024/05/16 15:31

去掉多余行数

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

最后一行Cell分割线

最后一行分隔线顶头显示

// 最后一行分隔线顶头显示// http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-workingstatic 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)

0 0
原创粉丝点击