Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 函数检查多列nstableview中是否有空单元格不工作_Objective C_Macos_Nstableview - Fatal编程技术网

Objective c 函数检查多列nstableview中是否有空单元格不工作

Objective c 函数检查多列nstableview中是否有空单元格不工作,objective-c,macos,nstableview,Objective C,Macos,Nstableview,您好,我已经编写了一个函数,用于检查如下所示的multicolumn nstableview中是否有空单元格。但是,此函数不起作用,始终只检查第一行中的列。。有什么建议吗?正确的检查方法是什么 -(BOOL)isTableRowsContainingEmptyCells { for(int row=0;row< [[self.myarray arrangedObjects] count];row++) { NSTableCo

您好,我已经编写了一个函数,用于检查如下所示的multicolumn nstableview中是否有空单元格。但是,此函数不起作用,始终只检查第一行中的列。。有什么建议吗?正确的检查方法是什么

  -(BOOL)isTableRowsContainingEmptyCells
    {



        for(int row=0;row< [[self.myarray arrangedObjects] count];row++)
        {
        NSTableColumn *column1 = [self.formFieldValues
                                  tableColumnWithIdentifier:@"A"];
        NSTableColumn *column2 = [self.formFieldValues
                                  tableColumnWithIdentifier:@"B"];
        NSCell *cell1 = [column1 dataCellForRow:row];
        NSCell *cell2 = [column2 dataCellForRow:row];
            NSLog(@"cell1 %@ cell2 %@",cell1,cell2);
        if([[cell1 stringValue] isEqualToString:@""]||[cell1 stringValue]==nil||[[cell2 stringValue] isEqualToString:@""]||[cell2 stringValue]==nil)
        {
            return YES;
        }
        }
        return NO;
    }
-(BOOL)isTableRowsContainingEmptyCells
{
for(int row=0;row<[[self.myarray arrangedObjects]计数];row++)
{
NSTableColumn*column1=[self.formFieldValues
tableColumnWithIdentifier:@“A”];
NSTableColumn*column2=[self.formFieldValues
tableColumnWithIdentifier:@“B”];
NSCell*cell1=[column1 dataCellForRow:row];
NSCell*cell2=[column2 dataCellForRow:row];
NSLog(@“cell1%@cell2%@”、cell1、cell2);
如果([[cell1 stringValue]IseQualtString:@”“]| |[cell1 stringValue]==nil | |[[cell2 stringValue]IseQualtString:@”“]|[cell2 stringValue]==nil)
{
返回YES;
}
}
返回否;
}
像这样试试

NSCell *cll=[tableView preparedCellAtColumn:0 row:0];
            NSString *str=[cll stringValue];
NSInteger len=[str length];
if (len ==0)
{
    NSLog(@"NO data")
}

为什么不使用控制器本身的numberOfRows来代替数组?我的意思是这部分:[[self.myarray arrangedObjects]count]因为最终这个数组本身就是tableviews数据源……两者都是正确的