2012-11-07 3 views
0

설명하는 방법을 모르겠다. UITableView 셀을 클릭하면 셀의 이름을 기반으로 제목이 업데이트되는 새보기로 이동하는 코드 줄이 있습니다. 그러나 두 개의 셀 (하나는 '원', 다른 하나는 '둘')을 클릭하면 '두'를 클릭하면 제목이 '원'인 뷰가 표시되고 그 반대의 경우도 표시됩니다. 어떤 생각이 이것의 원인 일 수 있습니까? 죄송합니다 더 도움이 될 수 없습니다.TableView 잘못된 셀로드 중

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; 
    ACollection *newView = [[ACollection alloc] init]; 
    newView.theTitle = [self.tableView cellForRowAtIndexPath:indexPath].textLabel.text; 
    [self.navigationController pushViewController:newView animated:YES]; 
} 
+0

은 당신의 코드를 보여 ... 나는 그것의 논리적 인 문제를 생각 –

+1

더 많은 코드를 제공 .. w –

+0

'didSelectRowAtIndexPath' 코드를 게시하시기 바랍니다 : –

답변

1

난 당신이 그냥이 코드를하려고이

에 대한 잘못된 방법을 선택했습니다 생각 :

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; 

    ACollection *newView = [[ACollection alloc] init]; 
    newView.theTitle = [self.tableView cellForRowAtIndexPath:indexPath].textLabel.text; 
    [self.navigationController pushViewController:newView animated:YES]; 
} 
+0

감사합니다! 선택 대신에 선택 해제 된 것으로 나타났습니다. 언제든지 환영합니다. –

+0

... :) –