title: NSFetchedResultsController with sections created by first letter of a string
body: <p>Learning Core Data on the iPhone. There seem to be few examples on Core Data populating a table view with sections.  The <a href="http://developer.apple.com/library/ios/#samplecode/CoreDataBooks/Introduction/Intro.html" rel="noreferrer">CoreDataBooks</a> example uses sections, but they're generated from full strings within the model.  I want to organize the Core Data table into sections by the first letter of a last name, a la the Address Book.</p>
  
  <p>I could go in and create another attribute, i.e. a single letter, for each person in order to act as the section division, but this seems kludgy.</p>
  
  <p>Here's what I'm starting with ... the trick seems to be fooling the <code>sectionNameKeyPath</code>:</p>
  
  <pre><code>- (NSFetchedResultsController *)fetchedResultsController {
  //.........SOME STUFF DELETED
      // Edit the sort key as appropriate.
      NSSortDescriptor *orderDescriptor = [[NSSortDescriptor alloc] initWithKey:@"personName" ascending:YES];
      NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:orderDescriptor, nil];
  
      [fetchRequest setSortDescriptors:sortDescriptors];
      // Edit the section name key path and cache name if appropriate.
      // nil for section name key path means "no sections".
      NSFetchedResultsController *aFetchedResultsController = 
              [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest 
              managedObjectContext:managedObjectContext 
              sectionNameKeyPath:@"personName" cacheName:@"Root"];
  //....
  }
  </code></pre>