title: Is there anyway to populate a UITableView with an array but persist checkmarks?
body: <p>I have an app that has a tab bar, each tab contains a separate table. The first table uses core data to persist its entries and checkmarks. The second table on the second tab uses an NSMutableArray to populate it (I would use core data but I would have to pre populate it and this table does not allow that)  I would like to persist check marks the same way I do in the first table with core data but something is wrong. The code looks like this:</p>
  
  <pre><code> -(void)viewDidLoad {
      [super viewDidLoad];
  airport = [[NSMutableArray alloc] init];
  [airport addObject:@"Passport"];
  }
  -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  return 1;
  }
  
  
  // Customize the number of rows in the table view.
  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  return [airport count];
  }
  
  
  // Customize the appearance of table view cells.
  - (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];
  }
  
  // Set up the cell...
  NSString *cellValue = [airport objectAtIndex:indexPath.row];
  cell.textLabel.text = cellValue;
  //[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
  
  
  NSManagedObject *item = [[self fetchedResultsController] objectAtIndexPath:indexPath];
  cell.textLabel.text = [item valueForKey:@"name"]; //CHANGED TO DETAIL
  
  
  if ([[item valueForKey:@"check"] boolValue]) {
      cell.accessoryType = UITableViewCellAccessoryCheckmark;
  } else {
      cell.accessoryType = UITableViewCellAccessoryNone;
  }
  
  cell.selectionStyle = UITableViewCellSelectionStyleNone;
  
      return cell;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  
  
  NSManagedObject *selectedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];
  
  
  if ([[selectedObject valueForKey:@"check"] boolValue]) {
      [selectedObject setValue:[NSNumber numberWithBool:NO] forKey:@"check"];
  } else {
      [selectedObject setValue:[NSNumber numberWithBool:YES] forKey:@"check"];
  }
  
  UITableViewCell *thisCell = [tableView cellForRowAtIndexPath:indexPath]; 
  if (thisCell.accessoryType == UITableViewCellAccessoryNone) {
      thisCell.accessoryType = UITableViewCellAccessoryCheckmark;  
  } else {
      thisCell.accessoryType = UITableViewCellAccessoryNone;
  } 
  [tableView deselectRowAtIndexPath:indexPath animated:NO];       
  </code></pre>
  
  <p>}</p>
  
  <p>I believe the line cell.textLabel.text = [item valueForKey@"name"];
   is whats causing it. All that I would like for this to do is have the table populated from the array and check marks persisted. Any help is GREATLY appreciated. Thanks in advance.</p>