Home > DeveloperSection > Forums > Creating index for NSIndexPath class method indexPathWithIndexes:length:
zack mathews
zack mathews

Total Post:23

Posted on    November-05-2015 5:19 AM

 iPhone iPhone  Ios  Objective C 

 1 Reply(s)
 1097  View(s)
Rate this:
The method of NSIndexPath class is:
+(id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length
My problem is with indexes, I am unable to create indexes for the first parameter?
In the documentation I was read it is as Array of indexes to make up the index path, but expecting a (NSUinteger*), to create index path of , is it simply an array of[ 1, 2, 3, 4 ] ?

Tarun Kumar

Total Post:214

Posted on    November-05-2015 10:21 PM

Your imagination is correct, it is like an array of NSUInteger, and the second parameter length is no of elements in the indexes array.
So you can use it like that:

NSUInteger arrayOfIndexes[] = { 1, 2, 3, 4 };
NSIndexPath *indexPath = [NSIndexPath indexPathWithIndexes:arrayOfIndexes

length: 4];

Modified On Nov-05-2015 10:21:41 PM

Don't want to miss updates? Please click the below button!

Follow MindStick