the text-copy of the message log is sorted by date

This commit is contained in:
Mitchell Livingston 2007-09-10 21:57:12 +00:00
parent 13e09a0185
commit a9c20a36ca
1 changed files with 7 additions and 2 deletions

View File

@ -194,10 +194,15 @@
- (void) writeToFile: (id) sender
{
//make the array sorted by date
NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"Date" ascending: YES] autorelease];
NSArray * descriptors = [[NSArray alloc] initWithObjects: descriptor, nil];
NSArray * sortedMessages = [fMessages sortedArrayUsingDescriptors: descriptors];
[descriptors release];
//create the text to output
NSMutableArray * messageStrings = [NSMutableArray arrayWithCapacity: [fMessages count]];
NSEnumerator * enumerator = [fMessages objectEnumerator];
NSEnumerator * enumerator = [sortedMessages objectEnumerator];
NSDictionary * message;
while ((message = [enumerator nextObject]))
[messageStrings addObject: [self stringForMessage: message]];