2012-05-21 3 views
0

6 개의 diffident 테이블이 있고 그 중 하나의 행이 선택되면 (regionsFirstTable에서 어느 것이 중요합니까?) 나는 그들에게 segue를 수행하기를 원합니다. regionsFirstTable에 대한 코드는 정상적으로 작동하지만 다른 부분에서는 그렇지 않습니다. 단절은 작동하지 않습니다. 나는 그것이 너무 지저분하다는 것을 압니다. 그러나 그 답은 표면에 놓여 있어야합니다.performSegueWithIdentifier if-statement가 작동하지 않습니다.

- (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

if (tableView == self.regionsFirstTable) { 
    {  if (indexPath.row==0) 
     if (indexPath.section==1) { 
      [self performSegueWithIdentifier:@"toAfricanFS" sender:indexPath]; 
     } else { 
      [self performSegueWithIdentifier:@"toAfricanFS" sender:indexPath]; 
     } 
     if (indexPath.row==1) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toAsiaFS" sender:indexPath]; 

      } else { 
       [self performSegueWithIdentifier:@"toAsiaFS" sender:indexPath]; 
      } 
     if (indexPath.row==2) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toEuropeFS" sender:indexPath]; 

      } else { 
       [self performSegueWithIdentifier:@"toEuropeFS" sender:indexPath]; 
      } 
     if (indexPath.row==3) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toLatinFS" sender:indexPath]; 
      } else { 
       [self performSegueWithIdentifier:@"toLatinFS" sender:indexPath]; 
      } 
     if (indexPath.row==4) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toNorthAmericaFS" sender:indexPath]; 
      } else { 
       [self performSegueWithIdentifier:@"toNorthAmericaFS" sender:indexPath]; 
      } 
    } //Dealing with the first UITableView, it works 

    if (tableView == self.africaFirstTable) { 
     [self performSegueWithIdentifier:@"fromAfricatoDone" sender:indexPath]; 
    } 
    if (tableView == self.asiaFirstTable) { 
     [self performSegueWithIdentifier:@"fromAsiatoDone" sender:indexPath]; 
    } 
    if (tableView == self.europeFirstTable) { 
     [self performSegueWithIdentifier:@"fromEuropetoDone" sender:indexPath]; 
    } 
    if (tableView == self.latinAmericaFirstTable) { 
     [self performSegueWithIdentifier:@"fromLatintoDone" sender:indexPath]; 
    } 
    if (tableView == self.northAmericaFirstTable) { 
     [self performSegueWithIdentifier:@"fromNorthAmericatoDone" sender:indexPath]; 
    } //This whole thing is not working as it should be 
} 
} 

미리 감사드립니다.

P. 내 모든 테이블은 하나의 indexPath.section에게이

첫 번째 if 후이 모든 if (tableView == self.regionsFirstTable) 블록 내에서 중첩되어 있기 때문에 if (tableView == self.northAmericaFirstTable)에 대한 모든 검사가 타격되지 않은, 너무 많은 {의이 마치
+0

더 이상 당신이 제공 할 수있는 정보가 있습니까 이론적으로, 고정 코드? 예외가 생기는 것처럼 들리는 것은 아닙니다. "self.africaFirstTable"행에서 시작하는 중단 점을 설정하면 이러한 if 문 중 하나라도 true로 해결됩니까? 그렇다면 segue id의 철자가 스토리 보드의 철자와 동일하다는 것을 확인 했습니까? – mservidio

+0

이름이 옳다. 스토리 보드에서 복사했는데 첫 번째 문장을 남겨두고 다른 문장을 주석 처리하더라도 여전히 작동하지 않는다. –

+0

segue가 수행되기를 기대하는 곳에서 브레이크 포인트를 치고 있습니까? – mservidio

답변

1

편집 : 여기

- (void)tableView:(UITableView *)tableView 
didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

if (tableView == self.regionsFirstTable) { 
    if (indexPath.row==0) 
     if (indexPath.section==1) { 
      [self performSegueWithIdentifier:@"toAfricanFS" sender:indexPath]; 
     } else { 
      [self performSegueWithIdentifier:@"toAfricanFS" sender:indexPath]; 
     } 
     if (indexPath.row==1) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toAsiaFS" sender:indexPath]; 

      } else { 
       [self performSegueWithIdentifier:@"toAsiaFS" sender:indexPath]; 
      } 
     if (indexPath.row==2) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toEuropeFS" sender:indexPath]; 

      } else { 
       [self performSegueWithIdentifier:@"toEuropeFS" sender:indexPath]; 
      } 
     if (indexPath.row==3) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toLatinFS" sender:indexPath]; 
      } else { 
       [self performSegueWithIdentifier:@"toLatinFS" sender:indexPath]; 
      } 
     if (indexPath.row==4) 
      if (indexPath.section==1) { 
       [self performSegueWithIdentifier:@"toNorthAmericaFS" sender:indexPath]; 
      } else { 
       [self performSegueWithIdentifier:@"toNorthAmericaFS" sender:indexPath]; 
      } 
    } //Dealing with the first UITableView, it works 

    if (tableView == self.africaFirstTable) { 
     [self performSegueWithIdentifier:@"fromAfricatoDone" sender:indexPath]; 
    } 
    if (tableView == self.asiaFirstTable) { 
     [self performSegueWithIdentifier:@"fromAsiatoDone" sender:indexPath]; 
    } 
    if (tableView == self.europeFirstTable) { 
     [self performSegueWithIdentifier:@"fromEuropetoDone" sender:indexPath]; 
    } 
    if (tableView == self.latinAmericaFirstTable) { 
     [self performSegueWithIdentifier:@"fromLatintoDone" sender:indexPath]; 
    } 
    if (tableView == self.northAmericaFirstTable) { 
     [self performSegueWithIdentifier:@"fromNorthAmericatoDone" sender:indexPath]; 
    } //This whole thing is not working as it should be 
} 
+0

매력적인 작품처럼! 당신의 도움을 주셔서 감사합니다! –

관련 문제