looping through an NSMutableDictionary

前端 未结 6 1164
野趣味
野趣味 2021-01-30 08:02

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

6条回答
  •  情书的邮戳
    2021-01-30 08:39

    Another way is to use the Dicts Enumerator. Here is some sample code from Apple:

    NSEnumerator *enumerator = [myDictionary objectEnumerator];
    id value;
    
    while ((value = [enumerator nextObject])) {
        /* code that acts on the dictionary’s values */
    }
    

提交回复
热议问题