I have created a NSIndexPath object but when I print the value of its length property it will always show the value as 2.
NSIndexPath *index = [NSIndexPath indexPathForItem:0 inSection:4];
{length = 2, path = 4 - 0}
Why length is always 2?
I have created a NSIndexPath object but when I print the value of its length property it will always show the value as 2.
NSIndexPath *index = [NSIndexPath indexPathForItem:0 inSection:4];
{length = 2, path = 4 - 0}
Why length is always 2?
Because the index path is made of two indexes - the section and the item number.
basically NSIndexPath
is combination of Section and Row, so it will show length as 2.