title: How can I change numberOfRowsInSection when I have multiple TableViews?
body: <p>This is my current code:</p>
  
  <pre><code>if (tableView == nearbyTV) {
      return numberOfObjects;
  }
  else {
      if (tableView == self.searchDisplayController.searchResultsTableView) {
          return [searchResults count];
      } 
      else {
          return [users count];
      }
  }
  </code></pre>
  
  <p>As you can see I am trying to reflect different indexes depending on the table view or a table view search display. The second view controller appears when the user clicks on a button. At this point if the second table view's index exceeds the first table view's index it crashes with the unfortunately familiar:</p>
  
  <pre><code>*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 13 beyond bounds [0 .. 12]'
  </code></pre>
  
  <p>What can I do to update the number of rows for the second table? Also I am some how getting information from the other table view as I am scrolling. Very frustrating. Any help at all would be very appreciated. Thanks.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>cellForRowAtIndexPath:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
          if (tableView == friendsTV || tableView == self.searchDisplayController.searchResultsTableView) {
          static NSString *simpleTableIdentifier = @"SimpleTableCell";
  
          SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
  
          if (cell == nil)
          {
              NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
              cell = [nib objectAtIndex:0];
          }else{
              cell.propic.image=nil;
              cell.flashBack.backgroundColor=[UIColor whiteColor];
              [cell.button1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
          }
          if (tableView == self.searchDisplayController.searchResultsTableView) {
              cell.fullName.text = [searchResults objectAtIndex:indexPath.row];
          }
          return cell;
          }else{
              static NSString *simpleTableIdentifier = @"nearbyTableCell";
  
              nearbyTableCell *cell = (nearbyTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
  
              if (cell == nil)
              {
                  NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"nearbyTableCell" owner:self options:nil];
                  cell = [nib objectAtIndex:0];
              }else{
                  cell.propic.image=nil;
                  cell.flashBack.backgroundColor=[UIColor whiteColor];
                  [cell.button2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
              }
              //    NSLog(@"%@",[searchResults objectAtIndex:indexPath.row]);
              if (tableView == self.searchDisplayController.searchResultsTableView) {
                  cell.fullName.text = [searchResults objectAtIndex:indexPath.row];
  
              }else if (tableView==nearbyTV){
                  NSString *requestCombine = [NSString stringWithFormat:@"/%@",[[json objectAtIndex:indexPath.row] objectForKey:@"fbID"]];
                  [FBRequestConnection startWithGraphPath:requestCombine
                                               parameters:nil
                                               HTTPMethod:@"GET"
                                        completionHandler:^(
                                                            FBRequestConnection *connection,
                                                            id result,
                                                            NSError *error
                                                            ) {
                                            cell.fullName.text=[result objectForKey:@"name"];
  
                                        }];
                  cell.fbIDLabel.text = [[json objectAtIndex:indexPath.row] objectForKey:@"fbID"];
              }
              return cell;
          }
  
  }
  </code></pre>