Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.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
Ios 在加载下一个单元格时获取上一个UITableViewCell_Ios_Objective C_Uitableview - Fatal编程技术网

Ios 在加载下一个单元格时获取上一个UITableViewCell

Ios 在加载下一个单元格时获取上一个UITableViewCell,ios,objective-c,uitableview,Ios,Objective C,Uitableview,所以,这很奇怪 我有一个UITableView,可以从cellForRowAtIndexPath加载单元格。在正确加载当前单元格之前,我想知道上一个单元格的状态,因此我使用CustomCell*cell=CustomCell*[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row-1 Instation:indexPath.section]]加载先前创建的单元格;但我总是得零分 我不确定发生了什么,因

所以,这很奇怪

我有一个UITableView,可以从cellForRowAtIndexPath加载单元格。在正确加载当前单元格之前,我想知道上一个单元格的状态,因此我使用CustomCell*cell=CustomCell*[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row-1 Instation:indexPath.section]]加载先前创建的单元格;但我总是得零分


我不确定发生了什么,因为这个过程似乎很简单-表视图是否不会在每次运行cellForRowAtIndexPath时都保存单元格?

我不确定在重新加载数据完成之前您是否可以访问单元格。我怀疑可能会发生这种情况。如果确实如此,我如何根据前一个单元格的状态设置单元格的当前状态?您能否解释一下为什么要访问previus单元格的状态?为什么要访问单元格的状态而不是访问传递给上一个单元格的数据?如何设置第一个单元格的状态您不能使用相同的方法设置第二个单元格吗?您不需要访问单元格来执行此操作,您应该访问数据源,它应该知道哪些数据已传递到上一个单元格。