title: Segue doesn't work because of searchbar
body: <p>I have made a table where depending on which cell you click on you will be sent into a new scene (detailviewcontroller). For example if you click on the cell with the text Thailand you will be sent to ThailandDetailViewController (scene). Everything works until you use the searchbar (look under - (void)tableView).</p>
  
  <p>-When some countries get outfiltered (because of the searchfunction) the reaming countries will go higher in the table and acquire a lower count. Which leads to that they will lead to the wrong detailviewcontroller (scene).</p>
  
  <p>A friend of mine said to me that I should use objectAtIndex within my array, didnt really catch what he meant with that.. And make a switch on the cell.textLabel.text (didnt really follow him)</p>
  
  <p>Here is my .m file:</p>
  
  <pre><code>- (void)viewDidLoad
  {
  [super viewDidLoad];
  self.mySearchBar.delegate = self;
  self.myTableView.delegate = self;
  self.myTableView.dataSource = self;
  
  totalStrings = [[NSMutableArray alloc] initWithObjects:@"America",@"Austria",@"Canada",@"France",@"Germany",@"Greece",@"Malaysia",@"Mexico",@"Netherlands",@"Poland",@"Russia",@"Singapore",@"Thailand",@"Ukraine", nil];    
  }
  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  
  switch (indexPath.row) {
      case 0: [self performSegueWithIdentifier:@"Segue0" sender:self];
          break;
      case 1: [self performSegueWithIdentifier:@"Segue1" sender:self];
          break;
      //and so on
      default: break;
  }
  }
  
  -(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
  {
  if(searchText.length == 0){
      isFiltered = NO;
  }
  else
  {
      isFiltered = YES;
      filteredStrings = [[NSMutableArray alloc]init];
      for (NSString *str in totalStrings){
          NSRange stringRange = [str rangeOfString:searchText      options:NSCaseInsensitiveSearch];
          if(stringRange.location !=NSNotFound) {
               [filteredStrings addObject:str];
          }
      }
  }
  [self.myTableView reloadData];
  }
  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath   *)indexPath
  {
  static NSString *Cellidentifier = @"cell";
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Cellidentifier];
  
  if (!cell) {
      cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Cellidentifier];
  }
  if (!isFiltered) {
      cell.textLabel.text = [totalStrings objectAtIndex:indexPath.row];
  }
  else //if it's filtered
  {
      cell.textLabel.text = [filteredStrings objectAtIndex:indexPath.row];
  }
  return cell;
  }
  </code></pre>
  
  <p>Big thank you in beforehand!!</p>