0

TabController에서 TabController에 2 개의 ViewController가 있습니다. TabBarController에서 TabControl과 TabBarController로 이동해야합니다. 내 TwoViewController에서TabBarController에서 ViewController로 끝내기

//AppDelegate.m 

UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:_viewController]; 
    self.window.rootViewController = nav; 

//ViewController.m 

tab=[[UITabBarController alloc]init]; 
    tab.delegate=self; 

    oneViewController=[[OneViewController alloc]init]; 

    UINavigationController *oneNav=[[UINavigationController alloc]initWithRootViewController:oneViewController]; 
    [email protected]"One"; 

    twoViewController=[[TwoViewController alloc]init]; 

    UINavigationController *twoNav=[[UINavigationController alloc]initWithRootViewController:twoViewController]; 
    [email protected]"Two"; 

    views=[[NSMutableArray alloc]initWithObjects:oneNav, twoNav, nil]; 

    tab.viewControllers=views; 
    [tab.view setFrame:CGRectMake(0, 0, 1024, 748)]; 

    [self.view addSubview:tab.view]; 

(탭 2) 나는 그 나는 다음과 같은 코드를 작성했습니다위한 버튼, ThanksViewController에 저를 취해야 클릭에있는 'OK'를했습니다 :

아래에있는 내 코드를 확인하시기 바랍니다 :

//TwoViewController.m 

-(void)OK 
{ 
    ThanksViewController *thanksViewController=[[ThanksViewController alloc]init]; 
    [self.navigationController pushViewController:thanksViewController animated:YES]; 
} 

내 문제는 내가 TabBarController 종료하고 (하단에 TabBarController없이) ThanksViewController로 이동하지만,이 경우에 나는 TwoViewController 대신에 TabBarController 자체에 ThanksViewController을 얻고있다 할 것입니다.

누군가이 사례에 대해 제게 제안 해 주시겠습니까? 미리 감사드립니다.

+0

가능한 중복 [버튼 클릭에 UINavigationController가에 UITabBarController가 종료하는 방법 (http://stackoverflow.com/questions/18332647/how-to-exit- from-uitavbarcontroller-to-uinavigationcontroller-on-button-click) – rckoenes

+0

그건 내 게시물 이었지만 적절한 응답을 얻을 수 없어서이 게시물에서 더 명확하게 생각했습니다. – maddy

답변

0

푸시 ThanksViewController 후 돌아가서 TabBarController를 다시 표시하고 싶습니까? 그렇다면은, 다음과 같이 모달 사용

ThanksViewController *view = [[ThanksViewController alloc] init]; 
UINavigationController *navThanks = [[UINavigationController alloc] initWithRootViewController:view]; 

[navThanks setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; 

[self presentModalViewController:navThanks animated:YES]; 
[self.view setHidden:YES]; 
+0

아니요. 다시 돌아갈 필요가 없습니다. TabBarController 다시, 나는 오직 ThanksViewController 만 원한다. – maddy

+0

그래서 tabBarController로 앱을 처음 시작한 것처럼 self.window를 변경해야합니다. 탐색 모음을 시작하고 self.window로 설정하면 tabBarController가 분리됩니다. –

+0

[self presentModalViewController : navThanks animated :]; iOS 6.0에서 더 이상 사용되지 않습니다. – maddy

관련 문제