4 Answers
4

You have to allocate the NSUInteger array of size [indexPath length] and pass it as argument. The return value will be written there. You have to release that array yourself or do nothing it was created on stack like this:

Thanks to you all for excellent answers! I get it now, thanks. I have chosen Max's answer for the solution even though all three are valid
–
user7865437Mar 11 '11 at 11:43

losing the plot here? NSUInteger array[[indexPath length]]; [indexPath getIndexes: array]; int len = sizeof(array)/sizeof(NSUInteger); NSLog(@"%i",len); no matter how many rows I have in a given section all I get back for len is 2 ?
–
user7865437Mar 11 '11 at 13:02

index path does not store the number of rows. it is used to effectively access cells. you need to use [tableView numberOfRowsInSection] for that
–
MaxMar 11 '11 at 13:41

Yes, two indexes: one for section and one for row. If rows could be subdivided, there might be three or more indexes, but right now there are just sections and rows.
–
CalebMar 11 '11 at 13:47

say the table has 3 sections and the middle section has 8 rows and the user has tapped any of the rows in the middle section, i presumed the getIndexes would return an array with 8 NSUIntegers that I could use to cycle through to access each cell in that given section?
–
user7865437Mar 11 '11 at 13:50

You send that message to an instance of NSIndexPath, so getting one back wouldn't help. The -getIndexes: method fills the array 'indexes' with the indexes from the index path. So you'd do something like:

Max, Thomas and Caleb, I have tried all three ways and cannot get anything to work, so maybe fired off the accepted solution too quick.....but probably more likely I just dont get it? I can't get the right size of the array in order to loop through it to access the required rows in my table. I would have though that calloc([indexPath length], sizeof(NSUInteger)) would for a group with 5 rows would return an array with 5 rows with each row holding NSUintegr.....or am of so far off beam it embarrassing?

An index path only specifies one section and one row, not all the rows in the table. Your table's data source and delegate work together to supply the rows for the table, so you should already know how many rows there are and have access to all their data.
–
CalebMar 11 '11 at 13:50