for each loop in Objective-C for accessing NSMutable dictionary
问题 I am finding some difficulty in accessing mutable dictionary keys and values in Objective-C. Suppose I have this: NSMutableDictionary *xyz=[[NSMutableDictionary alloc] init]; I can set keys and values. Now, I just want to access each key and value, but I don\'t know the number of keys set. In PHP it is very easy, something as follows: foreach ($xyz as $key => $value) How is it possible in Objective-C? 回答1: for (NSString* key in xyz) { id value = xyz[key]; // do stuff } This works for every