Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create the "indexes" required for NSIndexPath:indexPathWithIndexes:length:

The class method to create an index path with one or more nodes is:

+ (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length 

How do we create the "indexes" required in the first parameter?

The documentation listed it as Array of indexes to make up the index path but it is expecting a (NSUinteger *).

To create an index path of 1.2.3.4, is it simply an array of [1,2,3,4] ?

like image 329
Ronnie Liew Avatar asked Oct 08 '08 05:10

Ronnie Liew


1 Answers

You are correct. You might use it like this:

NSUInteger indexArr[] = {1,2,3,4};  NSIndexPath *indexPath = [NSIndexPath indexPathWithIndexes:indexArr length:4]; 
like image 120
Barry Wark Avatar answered Sep 27 '22 18:09

Barry Wark