Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSDictionary Key For Value/Object? [duplicate]

Can we get the key for an object in an NSDictionary by passing a particular value or object?

like image 465
Syed Absar Avatar asked May 25 '11 07:05

Syed Absar


People also ask

Does NSDictionary copy values?

NSDictionary / NSMutableDictionary copies keys, and holds strong references to values.

Does NSDictionary retain objects?

An NSDictionary will retain it's objects, and copy it's keys.

How do you set a value in NSDictionary?

You have to convert NSDictionary to NSMutableDictionary . You have to user NSMutableDictionary in place of the NSDictionary . After that you can able to change value in NSMutableDictionary .

What is a NSDictionary object?

An object representing a static collection of key-value pairs, for use instead of a Dictionary constant in cases that require reference semantics.


1 Answers

-[NSDictionary allKeysForObject:] returns an NSArray of all the keys whose objects match the passed object, where "match" is determined by isEqual:.

like image 116
jscs Avatar answered Oct 12 '22 11:10

jscs