美文网首页iOS UI
移除Cell的分割线 UITableViewCellSepara

移除Cell的分割线 UITableViewCellSepara

作者: 修正 | 来源:发表于2018-09-21 10:51 被阅读0次

进行判断,只移除个别 section 的第一行 cell 的分割线

- (void)tableView:(UITableView *)tableView willDisplayCell:(nonnull UITableViewCell *)cell forRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    if (indexPath.row == 0 && (indexPath.section == BXSDBMasterSectionIndexPoster || indexPath.section == BXSDBMasterSectionIndexMomentHelper)) {
        //隐藏第一行cell头部的线条
        [[[cell rac_signalForSelector:@selector(layoutSubviews)] takeUntil:[cell rac_signalForSelector:@selector(prepareForReuse)]] subscribeNext:^(id x) {
            [cell.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                if (obj.frame.origin.y == 0 &&
                    [obj isKindOfClass:NSClassFromString(@"_UITableViewCellSeparatorView")]) {
                    obj.hidden = YES;
                }
            }];
        }];
    }
}

相关文章

网友评论

    本文标题:移除Cell的分割线 UITableViewCellSepara

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