title: How to work with two different custom cells in one tableView ? Using Storyboard, iOS 7
body: <p>I have two custom cells. And I want to display 2 sections in my <code>UITableView</code>. The first section with one row displaying the first custom cell, and the second section displaying a list of objects pulled from core data. </p>
  
  <p>How should I implement the "cellForRowAtIndexpath" method ?</p>
  
  <p>Here is some of my code:</p>
  
  <pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  {
  
  // Return the number of sections.
  return 2;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
  
  // Return the number of rows in the section.
  if (section == 0) {
      return 1;
  
  } else if (section == 1) {
     //gastos is an array
     return [self.gastos count];  
  }
  return 0;
  }
  
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath         *)indexPath
  {
  
  switch (indexPath.section) {
      case 0:
      {
          SaldoCelda *cell1 = [tableView dequeueReusableCellWithIdentifier:@"Cell1"      forIndexPath:indexPath];
          return cell1;
      }
      case 1:
      {
          static NSString *CellIdentifier = @"Cell";
          CeldaGasto *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier      forIndexPath:indexPath];
  
          NSManagedObject *gasto = [self.gastos objectAtIndex:indexPath.row];
  
          [cell.monto setText:[NSString stringWithFormat:@"%@ AR$", [gasto valueForKey:@"monto"]]];
          [cell.categoria setText:[NSString stringWithFormat:@"%@", [gasto valueForKey:@"categoria"]]];
          [cell.fecha setText:[NSString stringWithFormat:@"%@", [gasto valueForKey:@"fecha"]]];
  
          return cell;
      }
      default:
          break;
  }
  return 0;
  }
  </code></pre>
  
  <p>And this is the error message I get:</p>
  
  <blockquote>
    <p>Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2903.23/UITableView.m:6246
    2014-03-05 01:02:57.181 Spendings[2897:70b] <em>*</em> Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'</p>
  </blockquote>
  
  <p>Thankyou for your help!</p>