2011-01-26 2 views
2

이것은 내 첫 번째 게시물이므로 부드럽게하십시오.rootViewController의 다중 레벨 탐색에서 detailViewController.detailItem을 업데이트하는 방법

xcode에서 기본 분할보기 기반 응용 프로그램을 사용하고 있지만 rootViewController가 단순히 detailViewController를 업데이트하지 않고 새 UITableViewController (taskViewController)를 탐색 스택에 푸시하도록 편집했습니다.

내 문제는 내가 지금 내 taskViewController에서 다음 호출 할 때 아무 일도 발생하지 않습니다이다 :

detailViewController.detailItem = [NSString stringWithFormat:@"Row %d", indexPath.row]; 

을 나는이 rootViewController에서 호출하는 경우, 대신 스택에 새로운 jQuery과 밀어, 그것은 작동합니다. 여기

는 셀이 선택 될 때 rootViewController에서 내 코드입니다 :

는 는 는

는 여기 뭔가 잘못 적이

- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    TaskViewController *taskViewController = [[TaskViewController alloc] init]; 

    taskViewController.title = [NSString stringWithFormat:@"Unit %d",indexPath.row]; 

    [self.navigationController pushViewController:taskViewController animated:YES]; 

    [taskViewController release]; 
} 
? UISplitViewController의 rootViewController 내에서 내비게이션 컨트롤러를 올바르게 사용하고 있습니까?

답변

5

rootViewController는 referView를 가지고 있기 때문에 detailViewController에 액세스 할 수 있습니다. 새 컨트롤러를 탐색 스택에 푸시하는 경우 이 아닌이 DetailViewController에 대해 자동으로 알게됩니다.

포인터가 있는지 보려면 작업보기에서 NSLog 'detailViewController이 있습니까?

- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    { 
     TaskViewController *taskViewController = [[TaskViewController alloc] init]; 

     taskViewController.title = [NSString stringWithFormat:@"Unit %d",indexPath.row]; 

     taskViewController.detailViewController = self.detailViewController; 

     [self.navigationController pushViewController:taskViewController animated:YES]; 

     [taskViewController release]; 
    } 
+0

우수함 :이처럼 만들 때

님 일반적으로이 설정합니다! 방금 UISplitViewController가이 모든 것을 처리했다고 가정했습니다. 고마워요 – Peetz

+0

기본 루트 및 세부 VC까지,하지만 그 이후에 자신의 - DW는, 당신이 밖으로 시작하는 일반적인 실수입니다. 나는 당신에게 경고해야한다, splitViewController는 다른 이슈들도 가지고있다. 나는 그 여행을 너 자신에게 맡길 것이다. 'NSLog'는 당신의 친구입니다. –

관련 문제