title: How to split up NSArray into NSDictionary by array object's NSDate day of year?
body: <p>I have a NSArray, and I sort it by its object's "published" property in descending order, newest first:</p>
  
  <pre><code>NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"published" ascending:YES];
  NSArray *descps = [[NSArray alloc] initWithObjects:[sortDescriptor reversedSortDescriptor], nil];
  [storiesLocal sortUsingDescriptors:descps];
  [descps release];
  [sortDescriptor release];
  </code></pre>
  
  <p>So now, I want to split this array up by each day, so that I can use it with a UITableView. In my example each date would be a tableview section header.
  So if my example sorted array (storiesLocal) had dates like such:</p>
  
  <pre><code>2010-04-05 10:32:00
  2010-04-05 06:20:12
  2010-04-02 09:23:02
  2010-04-02 03:20:34
  2010-04-01 04:22:34
  </code></pre>
  
  <p>Then I would have tableview headers like "April 5", "April 2", "April 1". Therefore each would have 2, 2 and 1 row under each corresponding header</p>
  
  <p>Essentially, my wanted outcome would be an NSDictionary. It's each key would be a date (2010-04-02), each value would be an NSArray of the correct objects to go with it. All of these should be sorted by date. Newest first.</p>
  
  <p>I've gone through about 3 tries and failed every time, ending up deleting the code I wrote.</p>
  
  <p>Edit: since an NSDictionary is an unordered list, it might be better to have an array of dictionaries, each dict including a key for the date and a key for the stories array, since order is very important.</p>