Programming Reference/Librarys
Question & Answer
Q&A is closed
- (NSArray *)allKeys
Returns a new array containing the dictionary’s keys, or an empty array if the dictionary has no entries.
Return Value - NSArray
// ** Init dictionary with entries NSDictionary *myDictionary = [[NSDictionary alloc]initWithObjectsAndKeys:@"value1", @"key1", @"value2", @"key2", nil]; NSArray *keysArray = [myDictionary allKeys]; // ** Output dictionary keys NSLog(@"myDictionary all keys: %@", keysArray);
2014-06-08 01:47:29.180 NSDictionary[3462:70b] myDictionary all keys: ( key2, key1 )