iOS UI

移除Cell的分割线 UITableViewCellSepara

2018-09-21  本文已影响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;
                }
            }];
        }];
    }
}

上一篇 下一篇

猜你喜欢

热点阅读