Search code examples
objective-ccocoaios4nsmutablearray

NSMutableArray removeObjectAtIndex


If I have an NSMutableArray with 10 objects

I run this line of code

[tempArray removeObjectAtIndex:0];

then

[tempArray count] should return 9

but does the entire Array shift up

Object At Index 1 moves to Index 0
Object at Index 2 moves to Index 1
...
Object at Index 9 moves to Index 8

or is Index 0 = nil?


Solution

  • From the NSMutableArray documentation:

    To fill the gap, all elements beyond index are moved by subtracting 1 from their index.