我需要保留表格视图的最后一个indexPath单元格并将其与
上的当前单元格进行比较- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
方法。我不知道该怎么做。我找到了最后一个选定单元格的答案,但这对我没有帮助。如果有人有什么解决办法,请告诉我。
要在tableview中保留lastindexpath的引用,请在cellForRowAtIndexPath中添加以下代码:
if(indexPath == _indexPathReference)
{
//add your logic
}
...
...
if(indexPath.row == array.count - 1)
_indexPathReference = indexPath;
return cell;
希望这对你有帮助!
你试试这个:
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:<Pass_Last_But_One_Row> inSection:<Pass_Correct_Section>]
,
Pass_Last_But_One_Row = cellDataModel。Count - 1;