views:

46

answers:

2

How do I loop through all objects in a NSMutableDictionary regardless of the keys?

+2  A: 

A standard way would look like this

for(id key in myDict) {
    id value = [myDict objectForKey:key];
    [value doStuff];
}
Henrik P. Hessel
+2  A: 

You can use [dict allValues] to get an NSArray of your values. Be aware that it doesn't guarantee any order between calls.

jv42
I would use this one over the (id key in dictionary), especially on a mutable dictionary, since the latter throws a nasty error if the dictionary is modified while being enumerated.
sigsegv