2011-02-26 8 views
1

각 탭마다 여러 개의보기가있는 탭 막대 앱이 있습니다. 탭에서 버튼을 누르면 다른 xib보기로 이동합니다. 버튼이 눌려져 탭 바의 첫 번째 탭으로 되돌아갑니다. 문제는 내가 돌아가려면 버튼을 누르면, FirstViewController에 대한 첫 번째보기로 가고 싶지 않아, 탭바 컨트롤러와 물건이있는 메인 윈도우로 가고 싶다. 단추는 탭 표시 줄없이 첫 번째보기로 이동합니다. 코드를 initWithNibName @ "MainWindow"로 변경하면 버튼을 누를 때 충돌이 발생합니다. 어떻게해야합니까?앱 탭 막대 다중보기 충돌

-(IBAction)back{ 
    FirstViewController *back = [[FirstViewController alloc] initWithNibName:@"MainWindow" bundle:nil]; 
    [self presentModalViewController:back animated:YES]; 
} //this is for going back 

-(IBAction)forward{ 
    test2 *forward = [[test2 alloc] initWithNibName:@"test2" bundle:nil]; 
    [self presentModalViewController:forward animated:NO]; 
} //this is for going to the view. by the way there are no errors or warnings, just "Debugging Terminated" when it crashes. 
+2

관련 코드를 표시하십시오. 그것 없이는 어떻게 우리가 너를 도울 수 있니? –

+0

코드는 어떻게 생겼습니까? "충돌"을 정의하십시오. 콘솔 출력이 있습니까? 추천 읽기 : http://msmvps.com/blogs/jon_skeet/archive/2010/08/29/writing-the-perfect-question.aspx – occulus

+0

- (IBAction) back { \t FirstViewController * back = [[FirstViewController alloc] initWithNibName : @ "MainWindow"번들 : nil]; \t [self presentModalViewController : back animated : YES]; } // 이것은 돌아 가기위한 것입니다. - (IBAction) forward { \t test2 * forward = [[test2 alloc] initWithNibName : @ "test2"번들 : nil]; \t [self presentModalViewController : forward animated : NO]; } //이보기로 이동하는 것입니다. 그런데 오류나 경고가 없으면 충돌이 발생했을 때 "디버깅이 종료되었습니다"라고 표시됩니다. – Guest

답변

1

당신은 뒤로 또는 앞으로 이동 presentModalViewController을 사용할 수 없습니다 : 여기

문제의 코드입니다. 모달 뷰 컨트롤러는 임시 유틸리티 뷰와 같아야합니다.

navigationController에있는 경우 pushViewController:animated:을 "드릴 다운"하고 popViewController:animated:을 사용하여 되돌아 가야합니다.