Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

set UITableViewProvider to show section titles for grouped table views

  • Loading branch information...
commit 641154069b63bb9178d73a7fd79e0da340e8e8d0 1 parent 2afb4a0
Tim Isted authored
View
1  Examples/iPhone/TimeStamps/TimeStamps.xcodeproj/project.pbxproj
@@ -159,6 +159,7 @@
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TimeStamps" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
View
2  README.markdown
@@ -169,7 +169,7 @@ To prevent the user from being able to select a row for some object, implement `
Implement the delegate method `tableViewCoreDataProvider:encounteredError:` to be informed of any errors as they occur.
###Fetched Results Controller settings
-To take advantage of the automatic section capabilities in `NSFetchedResultsController`, set the `sectionNameKeyPath` property on the provider object. The fetched results controller object is created lazily, so the `sectionNameKeyPath` property needs to be set before the provider object is asked for information by the table view. Note that if you specify a section name key path, `NSFetchedResultsController` requires you to provide suitable sort descriptors.
+To take advantage of the automatic section capabilities in `NSFetchedResultsController`, set the `sectionNameKeyPath` property on the provider object. The fetched results controller object is created lazily, so the `sectionNameKeyPath` property needs to be set before the provider object is asked for information by the table view. Note that if you specify a section name key path, `NSFetchedResultsController` requires you to provide suitable sort descriptors. **Update** the section name key path will now be used as the section title.
By default, the provider doesn't use a cache for the fetched results controller. Set the `cacheName` property to specify a cache.
View
7 TIUITableViewCoreDataProvider.m
@@ -252,6 +252,13 @@ - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)
return NO;
}
+- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
+{
+ id <NSFetchedResultsSectionInfo> sectionInfo = [[[self fetchedResultsController] sections] objectAtIndex:section];
+
+ return [sectionInfo name];
+}
+
#pragma mark -
#pragma mark Table View Delegate
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
Please sign in to comment.
Something went wrong with that request. Please try again.