title: cellForRowAtIndexPath returns null but really need similar method
body: <p>I have a <code>UITableView</code> in my <code>UITableViewController</code> (lol, obviously) but I need to get a cell at a given index inside the <code>- (void)viewWillAppear:(BOOL)animated</code> method.</p>
  
  <p>Now, my cells are static and I create them in the interface builder. If I call </p>
  
  <pre><code>UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:previously_selected_cell.integerValue inSection:0]];
  </code></pre>
  
  <p>it returns null for the cell. I only have 3 static cells in 1 sections. I tried both sections 0 and 1 and both return null.</p>
  
  <p>Currently I have removed the <code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath</code> method because if I add it, it will clear the <code>UITableView</code> of all my static cells.</p>
  
  <p>Is there a method I can call in <code>- (void)viewWillAppear:(BOOL)animated</code> that will return a cell at a given index?</p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT: I checked out <a href="https://stackoverflow.com/questions/9683881/cellforrowatindexpath-returns-null-value">this stackoverflow question</a> but I'm using static cells without cellForRowAtIndexPath so that question didn't help. :(</p>
  
  <p>EDIT2: I'm trying to set the accessory type of the cell when the view loads. But only on a certain cell, that cell being the one the user selected before he quit the app.</p>
  
  <pre><code>#import "AutoSyncSettings.h"
  #import "CDFetchController.h"
  
  
  @implementation AutoSyncSettings
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
  }
  
  #pragma mark - View lifecycle
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
  }
  
  - (void)viewDidUnload
  {
      [super viewDidUnload];
      // Release any retained subviews of the main view.
      // e.g. self.myOutlet = nil;
  }
  
  - (void)viewWillAppear:(BOOL)animated
  {
      CDFetchController *cdfc = [[CDFetchController alloc] init];
      NSFetchedResultsController *results = [cdfc getFetchedResultsControllerWithEntityName:@"SETTINGS"];
      NSArray *objects = [results fetchedObjects];
      NSNumber *sync_setting;
  
      if(objects.count &gt; 0)
      {     
          NSManagedObject *object = [objects objectAtIndex:0];
          sync_setting = [object valueForKey:@"wifi_setting"];
  
          NSLog(@"(Settings)sync_setting: %@",sync_setting);
      NSLog(@"(Settings)sync_setting int value: %i",sync_setting.integerValue);
      NSLog(@"(Settings)TableView: %@",self.tableView);
  
  //cell is null, even after this.
      UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:wifi_settings.integerValue inSection:0]];
      cell.accessoryType = UITableViewCellAccessoryCheckmark;
  //cell is still null. WHY OH WHY? :(
  
          objects = nil;
      }
  
      cdfc = nil;
      results = nil;
      objects = nil;
      sync_setting = nil;
  
      [super viewWillAppear:animated];
  }
  
  - (void)viewDidAppear:(BOOL)animated
  {
      [super viewDidAppear:animated];
  }
  
  - (void)viewWillDisappear:(BOOL)animated
  {
      [super viewWillDisappear:animated];
  }
  
  - (void)viewDidDisappear:(BOOL)animated
  {
      [super viewDidDisappear:animated];
  }
  
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
  {
      // Return YES for supported orientations
      return (interfaceOrientation == UIInterfaceOrientationPortrait);
  }
  
  #pragma mark - Table view data source
  
  - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
  {
      return NO;
  }
  
  - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
  {
      return NO;
  }
  
  #pragma mark - Table view delegate
  
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
      for (int i = 0; i &lt; [tableView numberOfRowsInSection:indexPath.section]; i++)
      {
          if([[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:indexPath.section]] accessoryType] == UITableViewCellAccessoryCheckmark)
          {
              [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:indexPath.section]].accessoryType = UITableViewCellAccessoryNone;
          }
      }
  
      UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
      cell.accessoryType = UITableViewCellAccessoryCheckmark;
  
      CDFetchController *cdfc = [[CDFetchController alloc] init];
      NSFetchedResultsController *results = [cdfc getFetchedResultsControllerWithEntityName:@"SETTINGS"];
      NSManagedObjectContext *context = [results managedObjectContext];
      NSArray *objects = [results fetchedObjects];
  
      if(objects.count &gt; 0)
      {
  
          NSManagedObject *object = [objects objectAtIndex:0];
  
          NSNumber *sync_setting = [NSNumber numberWithInt:indexPath.row];
          [object setValue:sync_setting forKey:@"sync_interval"];
          [object setValue:[NSNumber numberWithInt:0] forKey:@"id"];
  
          [ErrorHandler saveMoc:context];
      }
      else
      {
          //INSERT NEW OBJECT
          NSManagedObject *object = [NSEntityDescription insertNewObjectForEntityForName:@"SETTINGS" inManagedObjectContext:context];
  
          NSNumber *sync_setting = [NSNumber numberWithInt:indexPath.row];
          [object setValue:sync_setting forKey:@"sync_interval"];
          [object setValue:[NSNumber numberWithInt:0] forKey:@"id"];
  
          [ErrorHandler saveMoc:context];
      }
  }
  
  @end
  </code></pre>