Name
NSMutableDictionary — Mac OS X 10.0
Synopsis
NSDictionary, being an immutable class, does not
allow clients to add, remove, or replace member objects after
initialization. NSMutableDictionary, on the other
hand, allows for the kinds of operations that alter the contents of
the collection. Objects can be added to a
mutable dictionary by invoking setObject:forKey:,
and objects may be removed using
removeObjectForKey:. When an object is added to a
dictionary it is sent a retain message; when the
object is removed, the dictionary will offset the
retain with a release message.
NSMutableDictionary is toll-free bridged with the
Core Foundation type CFDictionary. As such,
NSMutableDictionary objects can be used
interchangeably with the CFDictionary pointer
type, CFDictionaryRef.
|
![]()
|
@interface NSMutableDictionary : NSDictionary
|
// Initializers
|
- (id)initWithCapacity:(unsigned)numItems; |
// Accessor Methods
|
- (void)setObject:(id)anObject forKey:(id)aKey; |
- (void)setDictionary:(NSDictionary *)otherDictionary; |
// Class Methods
|
+ (id)dictionaryWithCapacity:(unsigned)numItems; |
// Instance Methods
|
- (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary; |
- (void)removeAllObjects;
|
- (void)removeObjectForKey:(id)aKey; |
- (void)removeObjectsForKeys:(NSArray *)keyArray; |
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
