forum

Home / DeveloperSection / Forums / One Array - Multiple sections – NSIndexPath

One Array - Multiple sections – NSIndexPath

Tarun Kumar153927-Jul-2015

I have one big array with many values. I've sorted out the sections but I can't seem to get the indexpath right.

Basically, what I'm trying to do, is that if the previous section has 50 rows, the next indexpath.row should be 51->. The one after that should be 60-> and so fourth.

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);

    }

}

 

I hope I've made my question clear enough for you to understand.


Updated on 27-Jul-2015

Can you answer this question?


Answer

1 Answers

Liked By