Name
NSMutableArray — Mac OS X 10.0
Synopsis
This class extends the API of NSArray to allow for
mutable, ordered collections of objects.
NSMutableArray provides five primitive methods,
which form the basis for the rest of its methods:
addObject:,
insertObject:atIndex:,
removeLastObject,
removeObjectAtIndex:, and
replaceObjectAtIndex:withObject:. When an object
is added to
an
array, the array asserts some ownership over the object by sending it
a retain message. Likewise, when an object is
removed from an array, it is sent a release
message by the array.
NSMutableArray is toll-free bridged with the Core
Foundation type CFArray. As such,
NSMutableArray objects can be used interchangeably
with the CFArray pointer type,
CFArrayRef.
|
![]()
|
@interface NSMutableArray : NSArray
|
// Initializers
|
- (id)initWithCapacity:(unsigned)numItems; |
// Accessor Methods
|
- (void)setArray:(NSArray *)otherArray; |
// Class Methods
|
+ (id)arrayWithCapacity:(unsigned)numItems; |
// Instance Methods
|
- (void)addObject:(id)anObject; |
- (void)addObjectsFromArray:(NSArray *)otherArray; |
- (void)exchangeObjectAtIndex:(unsigned)idx1 withObjectAtIndex:(unsigned)idx2; |
- (void)insertObject:(id)anObject atIndex:(unsigned)index; |
- (void)removeAllObjects;
|
- (void)removeLastObject;
|
- (void)removeObject:(id)anObject; |
- (void)removeObject:(id)anObject inRange:(NSRange)range; |
- (void)removeObjectAtIndex ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
