一个数组 - 多个部分 - NSIndexPath

时间:2015-07-27 10:53:17

标签: objective-c uitableview

我有一个有很多值的大数组。我已经整理了这些部分,但我似乎无法正确获得索引路径。

基本上,我正在尝试做的是,如果上一节有50行,则下一个indexpath.row应为51->。之后的那个应该是60->等等第四。

NSLog(@"current indexpath.row: %ld",(long)indexPath.row);
NSLog(@"current section: %ld",(long)indexPath.section);
for (int i = indexPath.section; i == indexPath.section; i++) {
            NSLog(@"number of rows: %ld",(long)[self tableView:tableView numberOfRowsInSection:indexPath.section]);
            NSLog(@"in section: %ld",(long)indexPath.section);
    if (i++) {
        // add previous number of rows plus current

        int previousRows = [self tableView:tableView numberOfRowsInSection:indexPath.section*2];
        NSLog(@"now indexpath: %ld",(long)previousRows+indexPath.row);
    }
}

我希望我的问题足够清楚,让你明白。

1 个答案:

答案 0 :(得分:0)

rule_id无法正常工作。 EXECUTE IMMEDIATE从每个部分的0开始。

如果我理解正确,您想知道访问该数组的全局索引值。对于这种情况,我一直在使用这个小方法:

NSIndexPath