美文网首页
去掉cell最后一行分割线

去掉cell最后一行分割线

作者: 赤焰军少帅林殊 | 来源:发表于2017-12-07 12:19 被阅读75次
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        [cell setSeparatorInset:UIEdgeInsetsMake(0, 15*kRating, 0, 15*kRating)];
    }
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        [cell setLayoutMargins:UIEdgeInsetsMake(0, 15*kRating, 0, 15*kRating)];
    }
    
    //  隐藏每个分区最后一个cell的分割线
    if (indexPath.row == [tableView numberOfRowsInSection:indexPath.section]-1)
    {
        // 1.系统分割线,移到屏幕外
        cell.separatorInset = UIEdgeInsetsMake(0, 0, 0, cell.bounds.size.width);
        
    }
    
}

相关文章

网友评论

      本文标题:去掉cell最后一行分割线

      本文链接:https://www.haomeiwen.com/subject/zsjdixtx.html