开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜