2012-03-13 3 views
0

내 분할보기 응용 프로그램에서 테이블보기가 있습니다. 각각에 대해 다른보기 컨트롤러가 필요합니다. 예를 들어, 하나의 행 내가 칼하고 내가 다른 견해를 가질 수 있으며, 그들을 클릭에 내가 분할보기에서 테이블보기 위해 다음 코드를 수행 한UITableView 세부 컨트롤러보기

원하는보기를 얻을 수있다이 두 가지에 대한 있도록 다른 컴퓨터 등이다

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section  { 
GCRetractableSectionController* sectionController = [self.retractableControllers objectAtIndex:section]; 
return sectionController.numberOfRow; 
    } 

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    GCRetractableSectionController* sectionController = [self.retractableControllers objectAtIndex:indexPath.section]; 
    return [sectionController cellForRow:indexPath.row]; 
     } 

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


    GCRetractableSectionController* sectionController = [self.retractableControllers objectAtIndex:indexPath.section]; 

     if(indexPath.section == 0){ 
     if(indexPath.row == 0){ 
      return [sectionController didSelectCellAtRow:indexPath viewController:detailViewController withData:@""]; 
     } 
     else { 
     return [sectionController didSelectCellAtRow:indexPath viewController:detailViewController withData:[generalCalculatorArray objectAtIndex:indexPath.row - 1]]; 
     } 
    } 
    else if(indexPath.section == 1){ 
    if(indexPath.row == 0){ 
    return [sectionController didSelectCellAtRow:indexPath viewController:detailViewController withData:@""]; 
    } 
     else { 
     return [sectionController didSelectCellAtRow:indexPath viewController:detailViewController withData:[cardiologyArray objectAtIndex:indexPath.row - 1]]; 
    } 

    } 
} 
+0

그리고 귀하의 질문은 ...? –

+0

그대로 실행하면 어떻게됩니까? –

+0

자세히보기 컨트롤러에 셀의 동일한 텍스트를 표시하므로 별도의보기 컨트롤러가있는 모든 셀에 어떤 방법으로도 표시 할 수 있습니다. – user1263350

답변

0

애플의 예를 가지고 당신은 Here You Go, 찾고 있습니다 또는 당신은 정확하게 다음

NSArray *viewControllers = [[NSArray alloc] initWithObjects:self.navigationController, detailViewController, nil];

계속 읽고 알아야 할 경우 위의 줄에 detailViewController 변경할 세부보기 컨트롤러의 인스턴스를 나타냅니다. 상세보기 계속 변화하지만,이 당신을하는 데 도움이 분할 뷰 컨트롤러의 뷰 컨트롤러 업데이트에 배열

splitViewController.viewControllers = viewControllers;
[viewControllers release];

희망 필요가있다. 의견을 올리지 않으면 제발.

관련 문제