UITableView не показывает ячейки - PullRequest
       106

UITableView не показывает ячейки

0 голосов
/ 02 декабря 2019

Я добавляю tableView в UIView, и все идет хорошо после отладки. Метод 'cellForRow:atIndexPath' вызывается, и у ячейки есть подпредставления, если я отлаживаю его. Но пока смотрю на интерфейс. Там нет ячейки на экране. Вот код:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellId = @"obCodeListCell";
    JobCodeListCell* cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (!cell) {
        cell = [[JobCodeListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.detailTextLabel.text = @"asdsada";
    cell.jobCodeLabel.text = @"test";

    cell.backgroundColor = UIColor.redColor;
    return cell;
}

и вот как я добавил TableView

- (void)setupView
{
    self.tableView = [[UITableView alloc] init];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.scrollEnabled = false;
    _tableView.alwaysBounceVertical = false;
    _tableView.backgroundView = nil;
    _tableView.backgroundColor = UIColor.clearColor;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self addSubview:_tableView];
    [_tableView autoPinEdgesToSuperviewEdges];
}

, теперь это то, что я получаю в симуляторе. Он должен был отображать красный цвет как минимум:

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...