Closed BasitAli closed 11 years ago
Sure, can do.
I'm curious, can you tell me more about your SSCoreDataSource
subclass?
My Collection and Table views were programmed to show an extra "Add New" cell at the end. This is what my subclass looks like,
- (id)itemAtIndexPath:(NSIndexPath *)indexPath {
if( indexPath.row < self.itemCount )
return [self.controller objectAtIndexPath:indexPath];
return nil;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [self.controller sections][(NSUInteger)section];
return (NSInteger)[sectionInfo numberOfObjects] + 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [self.controller sections][(NSUInteger)section];
return (NSInteger)[sectionInfo numberOfObjects] + 1;
}
Added in d1932eb.
Move
@property (nonatomic, strong) NSFetchedResultsController *controller;
as a public property so that subclasses os SSCoreDataSource can access the controller.