Creating index for NSIndexPath class method indexPathWithIndexes:length:

Total Post:23

Points:161
 1490  View(s)
Ratings:
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 1.2.3.4 , is it simply an array of[ 1, 2, 3, 4 ] ?
  1. Post:214

    Points:1642
    Re: Creating index for NSIndexPath class method indexPathWithIndexes:length:

    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 Apr-10-2018 05:35:00 AM

Answer