title: Can't reload Table View in tab bar controller
body: <p>Hi I have a tab tab controller and my first tab includes a view with: </p>
  
  <ul>
  <li>3 text fields</li>
  <li>a submit button</li>
  <li>a tableView</li>
  </ul>
  
  <p>Once I fill in the text fields I click submit and it adds the information to my managedObjectContext which is an sqlite database (CoreData). </p>
  
  <p>As soon as I click submit I want the tableView to reload to include the added object. Currently my tableView will display the data in the database but it will only add the new row when I stop and re-run the simulator</p>
  
  <p>This is the code for when the add button is tapped, it is here that I can't get the reload tableView working because it says tableView is an undeclared identifier, what have i missed?</p>
  
  <pre><code>-(IBAction)addButtonTapped:(id)sender {
  NSLog (@"Add Button Tapped");
  NSLog(@"Adding %@ units of item code %@ at $%@ each",quantityTextField.text,productTextField.text,priceTextField.text);
  
  
  Products_MarketAppDelegate* delegate = [[UIApplication sharedApplication] delegate];
  NSManagedObjectContext* managedObjectContext = delegate.managedObjectContext;
  NSManagedObject* newProduct;
  newProduct = [NSEntityDescription insertNewObjectForEntityForName:@"Product" inManagedObjectContext:managedObjectContext];
  
  [newProduct setValue:productTextField.text forKey:@"itemCode"];
  [newProduct setValue:quantityTextField.text forKey:@"quantity"];
  [newProduct setValue:priceTextField.text forKey:@"price"];
  
  if ([managedObjectContext hasChanges]) 
      NSLog(@"Managed Object Changed");
  
  NSError* error;
  [managedObjectContext save:&amp;error];
  
  // Insert Reload Table Code Here
  // ** I have tried the following and it gives an error "Use of undeclared identifier 'tableView'"
  //[tableView reloadData];
  //[self.tableView reloadData];
  
  }
  </code></pre>
  
  <p>As you can see below I have added the UITableViewDelegate &amp; UITableViewDataSource in the header file. I have also hooked up the tableview in IB so that the delegate and datasource connections are linked to file's owner.</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;CoreData/CoreData.h&gt;
  
  
  @interface FirstViewController : UIViewController
  &lt;UIApplicationDelegate, UITableViewDataSource,UITableViewDelegate,NSFetchedResultsControllerDelegate&gt;
  
  {
  IBOutlet UITextField *productTextField;
  IBOutlet UITextField *quantityTextField;
  IBOutlet UITextField *priceTextField;
  
  NSMutableArray *items;
  NSFetchedResultsController *fetchedResultsController;
  }
  
  @property (nonatomic, retain) NSMutableArray *items;
  @property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
  
  -(IBAction)addButtonTapped:(id)sender;
  
  @end
  </code></pre>
  
  <p>This is the code to fill the tableView which works correctly</p>
  
  <pre><code>#pragma mark TableView
  -(NSInteger)numberOfSectionsInTableView: (UITableView *)tableView {
  return 1;
  }
  
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  
  {
  id &lt;NSFetchedResultsSectionInfo&gt; sectionInfo = [[fetchedResultsController sections] objectAtIndex:section];
  return [sectionInfo numberOfObjects];
  }
  
  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  
  {
  static NSString *CellIdentifier = @"Cell";
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil){   
      cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];    
  }
  
  // Configure the cell
  Product* productItem =[fetchedResultsController objectAtIndexPath:indexPath];
  cell.textLabel.text = [NSString stringWithFormat:@"%@ x %@ @ $%@",productItem.quantity,productItem.itemCode,productItem.price];
  
  return cell;  
  }
  </code></pre>
  
  <p>I have searched for answers on this site and on others but I must be doing something different and the solutions aren't helping me</p>