How to sort array of dictionary in objective c?
Answer / Mahendra
To sort an array of NSDictionary objects based on the value of a specific key, you can use the following code:
```objectivec
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"your_key" ascending:YES];
NSArray *sortedArray = [yourArray sortedArrayUsingDescriptors:@[sortDescriptor]];
```
Replace 'your_key' with the key you want to sort by and assign your array variable name to 'yourArray'. If you need to sort in descending order, set ascending to NO.
| Is This Answer Correct ? | 0 Yes | 0 No |
what is gcd? What are advantages over nsthread?
Can I write some c++ function in same .m file? Will it compile? If no, what changes should I do to compile it?
What are some of the major differences between objective c and swift?
What is synthesize objective c?
Does objective c have garbage collection?
How does dispatch_once manages to run only once?
What is a selector objective c?
What is property classification?
Explain how to call a function in objective-c?
How to convert string to nsnumber in objective c?
What are blocks and how are they used?
What is synthesized in objective-c?