Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
- if (section == 0) {
- id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
- return [sectionInfo numberOfObjects];
- } else {
- return 1;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *CellIdentifier = @"Category Cell";
- CategoryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- cell = [[CategoryCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
- }
- // Configure the cell...
- if (indexPath.section == 0) {
- NSLog(@"section %i",indexPath.section);
- Category *category = [self.fetchedResultsController objectAtIndexPath:indexPath];
- cell.categoryNameLabel.text = category.name;
- cell.categoryNumberItemsLabel.text = [NSString stringWithFormat:@"%i",category.containItem.count];
- } else {
- NSLog(@"section 2");
- //Static cell
- cell.categoryNameLabel.text = @"ALL";
- }
- return cell;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement