UITableviewcell рисует пустые ячейки - PullRequest
0 голосов
/ 22 марта 2012

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

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString* cellIdentifier2 = @"Cell2";
    UITableViewCell *cell2 = [tableView dequeueReusableCellWithIdentifier:cellIdentifier2];   

    if (cell2 == nil ||[cell2.textLabel.text isEqualToString:@"(null)"]) {
        NSLog(@"Came inside cell2 == nil");
        cell2 = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier2];
    }
    else {
        NSLog(@"inside else statement");
            [self configureCell:cell2 atIndexPath:indexPath];
    }

    NSString *text = cell2.textLabel.text;
    NSLog(@"OUtput - item 1 - Cell2:: %@",text);
    return cell2;
}

приведенный выше код, похоже, ничего не делает ипо-прежнему рисует пустую ячейку без содержимого.В любом случае, как это остановить?

код для configureCell

- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
    NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];
    cell.textLabel.text = [[object valueForKey:@"dbTextField"] description];
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...