2012-01-31 2 views
0

2 개의보기가있는 UITabBar가 있습니다. 하나의보기에 UITable이 포함되어 있습니다. 셀을 선택할 때 다른보기로 이동하려고합니다.iPhone : tabbar에있는 표 셀을 선택하면보기가 변경됩니다.

if(self.damageController == nil) 
    { 

     DamageControllerOverview *viewTwo = [[DamageControllerOverview alloc] initWithNibName:@"DamageControllerOverview" bundle:[NSBundle mainBundle]]; 


     self.damageController = viewTwo; 
     self.damageController.damageAccount = damageAccount; 
     self.damageController.ma = ma; 

     [self.navigationController setNavigationBarHidden:NO animated:NO]; 

     temporaryBarButtonItem = [[UIBarButtonItem alloc] init]; 
     temporaryBarButtonItem.title = @"Back"; 

     self.navigationItem.backBarButtonItem = temporaryBarButtonItem; 

     [viewTwo release]; 
    } 

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

을하지만이 TabBar의 테이블이 있기 때문에 그것은 더 이상 작동하지 않습니다 :

나는 항상이 코드로했다. 이유를 아는 사람이 있습니까?

안부 멜라니

* 편집 : 이 내 rootviewcontroller 없습니다. 나는 이미있는 navigationController을 가지고

답변

1

내가 뭘 질문에서 이해하는 것이있는 TabBar의에서 새로 만들 싶지 않아 당신은 2 - 당신에게 메인 창에서 tabbar

1 tabbar에 navigationController이 있어야합니다.

컨트롤러를이 방법으로 navigationController에 밀어 넣어야합니다.

[self.tabBarController.navigationController pushViewController:self.damageController animated:YES]; 

대신 [self.navigationController pushViewController:self.damageController animated:YES];

가 나는

+0

안녕하세요 도움이되기를 바랍니다. 내 tabbar에 navigationController가 없습니다. 내 rootview에 navigationController가 있습니다. (그쪽 tabbar와 함께보기가 아닙니다) 두 번째 navigationController tabbar 필요합니까? – DeFlo

+1

네, 네비게이션 컨트롤러 주먹을 탭바에 추가해야하고, 로토 컨트롤러를 밀어 넣어야합니다. 현재 viewController를 tabbar에 직접 푸시하면 네비게이션 기능이 제공되지 않습니다. –

+1

현재 self.navigationController는 nil이 될 것입니다. 왜냐하면 여러분이 viewController를 가지고 있지 않기 때문에 oushViewController를 nil navigationController에서 호출했기 때문입니다. 즉 push되지 않은 이유입니다. ViewController 클래스에 대한 링크 Refrences는 아래에 있습니다. navigationController 속성 섹션을 확인하여 navigationController에 대한 기본 지식을 얻으십시오. 컨트롤러 http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/ 참조/Reference.html –

관련 문제