Grouped UITableview remove outer separator line

前端 未结 19 2131
遇见更好的自我
遇见更好的自我 2020-12-02 10:58

I have a grouped UITableview which is created programatically. Also I have a cell with xib file populated in tableview programmatically as well. So far so good. But I want t

相关标签:
19条回答
  • 2020-12-02 11:50

    Try this it will remove top separator line.

    -(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        if(indexPath.row == 0 && indexPath.section == 0) {
            for (UIView *view in  cell.subviews) {
                if ([NSStringFromClass([view class]) containsString:@"CellSeparator"]) {
                    if (view.frame.origin.y == 0 && CGRectGetHeight(view.frame) < 1.01 ) { //Hide first UITableViewCellSeparatorView
                        NSLog(@"%s Remove View From Cell[Section:0 Row:0] for top border [%@]:%@",__FUNCTION__,NSStringFromClass([view class]),view);
                        view.hidden = YES; //Hide
                    }
                }
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题