removeObjectAtIndex:
Removes the object at index .
- (void)removeObjectAtIndex:(NSUInteger)index
Parameters
- index
- The index from which to remove the object in the array. The value must not exceed the bounds of the array.
Discussion
To fill the gap, all elements beyond index are moved by subtracting 1 from their index.
E.g:
CAPropertyAnimation * nextAnimation = [[self sequenceOfAnimations] objectAtIndex:0];
[[self sequenceOfAnimations] removeObjectAtIndex:0];
Assigning nextAnimation with object at index 0 and after that we removed.Thing is all objects beyond index 0 are shifted one place left to fill the gap.So the above two lines act like a queue,always first object will be removed.
sequenceOfAnimations array has contents in this fashion
[obj1,obj2,obj3,obj4,obj5,nil];
removeObjectAtIndex:0
now sequenceOfAnimations will be [obj2,obj3,obj4,obj5,nil];
removeObjectAtIndex:0
now sequenceOfAnimations will be [obj3,obj4,obj5,nil];
No comments:
Post a Comment