How to retrieve all keys from a dictionary?
How can I retrieve all the keys (only) from a NSDictionary? I do not need them in any particu开发者_JAVA百科lar order.
Use the allKeys
method on your NSDictionary
.
From the docs:
allKeys
: Returns a new array containing the dictionary’s keys.
- (NSArray *)allKeys
Return Value
A new array containing the dictionary’s keys, or an empty array if the dictionary has no entries.
I advise you to study the Dokumentation. ;-) Take a look here:
- (NSArray *)allKeys;
From the Dokumentation:
Returns a new array containing the dictionary’s keys.
- (NSArray *)allKeys
Return Value A new array containing the dictionary’s keys, or an empty array if the dictionary has no entries.
Discussion The order of the elements in the array is not defined.
精彩评论