Search code examples
iphonensarray

NSArray + remove item from array


How to remove an item from NSArray.


Solution

  • NSArray is not mutable, that is, you cannot modify it. You should take a look at NSMutableArray. Check out the "Removing Objects" section, you'll find there many functions that allow you to remove items:

    [anArray removeObjectAtIndex: index];
    [anArray removeObject: item];
    [anArray removeLastObject];