title: Using Apple's TouchCell example, how can I create a UIBarButtonItem item if one or more cells are checked?
body: <p>The tableview is populated from a .plist.<br>
  I want to be create an "ADD" button on the navBar if one or more cells are checked and remove the "ADD" button once all of the cells are unchecked.  The best I've been able to do is add the button when a cell is checked and remove the button when the cell is unchecked but this is not taking into account that other cells may have a checkmark in them.  If any cell is in the table has a checkmark, the "ADD" button should be present. 
  The example code I'm working with can be found here: <a href="http://developer.apple.com/library/ios/#samplecode/TouchCells/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008062" rel="nofollow">http://developer.apple.com/library/ios/#samplecode/TouchCells/Introduction/Intro.html#//apple_ref/doc/uid/DTS40008062</a></p>
  
  <p>In the didSelectRowAtIndexPath method, I've added:</p>
  
  <pre><code>if (targetCustomCell.checked)
  {
  
  UIBarButtonItem *saveButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Add" 
  style:UIBarButtonItemStyleDone target:self action:@selector(add)];
  
  self.navigationItem.rightBarButtonItem = saveButtonItem;
  }
  else
  {
      self.navigationItem.rightBarButtonItem = nil;
  }
  </code></pre>
  
  <p>I'm including the DidSelectRowAtIndexPath for reference:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
  // find the cell being touched and update its checked/unchecked image
  CustomCell *targetCustomCell = (CustomCell *)[tableView cellForRowAtIndexPath:indexPath];
  [targetCustomCell checkAction:nil];
  
  // don't keep the table selection
  [tableView deselectRowAtIndexPath:indexPath animated:YES];
  
  // update our data source array with the new checked state
  NSMutableDictionary *selectedItem = [self.dataArray objectAtIndex:indexPath.row];
  [selectedItem setObject:[NSNumber numberWithBool:targetCustomCell.checked] forKey:@"checked"];
  }
  </code></pre>
  
  <p>Thank you for any help - it's really appreciated!</p>