Instance Method

setObject:forKey:

Adds a given key-value pair to the dictionary.

Declaration

- (void)setObject:(ObjectType)anObject forKey:(id<NSCopying>)aKey;

Parameters

anObject

The value for aKey. A strong reference to the object is maintained by the dictionary.

aKey

The key for value. The key is copied (using copyWithZone:; keys must conform to the NSCopying protocol). If aKey already exists in the dictionary, anObject takes its place.

See Also

Adding Entries to a Mutable Dictionary

- setObject:forKeyedSubscript:

Adds a given key-value pair to the dictionary.

- setValue:forKey:

Adds a given key-value pair to the dictionary.

- addEntriesFromDictionary:

Adds to the receiving dictionary the entries from another dictionary.

- setDictionary:

Sets the contents of the receiving dictionary to entries in a given dictionary.