Here is an example. Imagines you have an array of dictionnaries. Ecah dictionnary have 2 keys “name” & “dateOfBirth”. You can sort your array by “name” like this :
//
// Sort array by name
//
NSSortDescriptor *Sorter = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
[myArray sortUsingDescriptors:[NSArray arrayWithObject:Sorter]];
[Sorter release];
Note that myArray
is a NSMutableArray
.
Related Contents:
- How to detect iPhone 5 (widescreen devices)?
- How can we programmatically detect which iOS version is device running on? [duplicate]
- Programmatically Request Access to Contacts
- Declaration/definition of variables locations in ObjectiveC?
- Example or explanation of Core Data Migration with multiple passes?
- iOS SDK – Programmatically generate a PDF file
- Storyboard – refer to ViewController in AppDelegate
- Change iOS app’s language on the fly
- iCloud basics and code sample [closed]
- Detecting when the ‘back’ button is pressed on a navbar
- When should I release objects in -(void)viewDidUnload rather than in -dealloc?
- Implementing NSCopying
- UITableView infinite scrolling
- Grand Central Dispatch (GCD) vs. performSelector – need a better explanation
- How do I auto size a UIScrollView to fit its content
- iOS 7 Navigation Bar text and arrow color
- UIPageViewController, how do I correctly jump to a specific page without messing up the order specified by the data source?
- Center text vertically in a UITextView
- How to get the CGPoint(s) of a CGPath
- UILabel updating stops during scrolling UIScrollView
- Dismissing a Presented View Controller
- How should I store UIImages within my Core Data database?
- Convert JSON feed to NSDictionary
- Call a parent view controller (through a navigationcontroller)
- CAGradientLayer, not resizing nicely, tearing on rotation
- Objective-C: Find numbers in string
- Detecting if iOS app is run in debugger
- Streaming mp3 audio with AVPlayer
- writing NSDictionary to plist in my app bundle
- iOS devices as web server [closed]
- iOS – Scale and crop CMSampleBufferRef/CVImageBufferRef
- How to cache content in UIWebView for faster loading later on?
- Finding list of installed apps on iphone
- What does the -ObjC linker flag do?
- iOS: Access app-info.plist variables in code
- CALayers didn’t get resized on its UIView’s bounds change. Why?
- Drawing Smooth Curves – Methods Needed
- UITableView Scroll event
- Last In-First Out Stack with GCD?
- Disable Dictation button on the keyboard of iPhone 4S / new iPad
- Enabling crash logs symbolication in Xcode 4.2
- Could not find a storyboard named ‘Main’ in bundle
- Converting NSData to NSString in Objective c
- NSDateFormatter, am I doing something wrong or is this a bug?
- Sorting NSString values as if NSInteger using NSSortDescriptor
- How can you apply distortions to a UIImage using OpenGL ES?
- iphone Core Data Unresolved error while saving
- UIBarButtonItem: target-action not working?
- Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
- How can I disable landscape orientation?