Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Create dictionary with attributes I care about and a fileList array
- NSMutableArray *fileList = [[NSMutableArray alloc] initWithCapacity:10];
- NSDictionary *fileData = [NSDictionary dictionaryWithObjectsAndKeys:file, @"file", dateString, @"date", nil];
- [fileList addObject:fileData];
- //I don't know how to sort this array by the "date" key!
- NSArray *files = [fm contentsOfDirectoryAtPath:folderPath error:NULL];
- //iterate through files array
- for (NSString *file in files) {
- NSString *path = [folderPath stringByAppendingPathComponent:file];
- //code to create custom object with contents of file as properties
- //feed object to fileList, which displays it in the tableview
- NSSortDescriptor *aSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES];
- [sortedFiles sortUsingDescriptors:[NSArray arrayWithObject:aSortDescriptor]];
- NSSortDescriptor *aSortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"date" ascending:YES];
- [sortedFiles sortUsingDescriptors:[NSArray arrayWithObject:aSortDescriptor]];
Add Comment
Please, Sign In to add comment