If I have an index path with value : { 0, 0}. What is the proper way to change it to { 0, 1} ? I know if it were an ordinary c array it would just be :
unsigned i_array[] = { 0, 0};
i_array[1] = 1;
But from NSIndexPath’s documentation, the closest I can get is with :
– indexPathByRemovingLastIndex
– indexPathByAddingIndex:
It seems a bit cumbersome. Is there a way that I can just overwrite the last member of the index array ?
NSIndexPathis not an array. It’s an object with 2 readonly properties:rowandsection. You can’t change them, however, you can create a new indexPath based on the old one: