Objective c UITableviewcell绘制空单元格

Objective c UITableviewcell绘制空单元格,objective-c,uitableview,Objective C,Uitableview,我需要使用什么方法来确保当前视图中没有空单元格被绘制到其绘制空单元格,因此我尝试放置以下代码: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellIdentifier2 = @"Cell2"; UITableViewCell *cell2 = [tableView dequeueR

我需要使用什么方法来确保当前视图中没有空单元格被绘制到其绘制空单元格,因此我尝试放置以下代码:

- (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];
}

configureCell中有什么?我打赌问题就在那里。把描述记录到里面的控制台上。如果为空,则数据提取不正确。@EvanMulawski数据显示良好,但它在其他表中添加了额外的单元格,这是我的设置选项卡控制器,包含2个导航控制器,其中包含uitableviewcontroller,代码与主详细信息模板相同-当我在一个表中添加代码时,空单元格出现在表2中,这是我试图避免的。