2012-05-11 4 views
0

xml 파일에 두 개 이상의 파일이 포함되어있는 경우 응용 프로그램을 체크인합니다. 그렇지 않으면 viewcontroller를 자동으로 다른 viewcontroller에 푸시하고 싶습니다.자동으로 푸시하는 방법

지금이 작업을하고 있지만 작동하지만 그렇습니다!

ViewControllerthree *Controller = [[ViewControllerthree alloc] initWithNibName:@"ViewControllerthree" bundle:[NSBundle mainBundle]]; 

Controller.Title = [item objectForKey:@"Title"]; 
[self.navigationController pushViewController:Controller animated:YES]; 
Controller = nil; 

내가 그래서이 코드를 combinate 할 :

UIViewController *rootController = [[ViewControllerOne alloc] initWithNibName:@"ViewControllerOne" bundle:nil]; 

navigationController = [[UINavigationController alloc] initWithRootViewController:rootController]; 

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
[self.window addSubview:navigationController.view]; 
[self.window makeKeyAndVisible]; 

은 내가하고있어이 작업을 수행하기 위해 일반적으로 내가 (ViewControllerOne)에 밀어있어 일에 대한 첫 번째의 ViewController에서 데이터를 보낼 필요 ViewController에 두 가지가 포함되어 있으면 컨트롤러를 '리디렉션'할 수 있습니다. 뷰 컨트롤러에 표시되는 백 버튼없이 푸시해야합니다. 데이터를 넣으려고합니다.

+2

나는 당신의 질문을 이해하지 않습니다. 게시 한 코드가 귀하의 질문과 관련이없는 것 같습니다. – onnoweb

+0

닫을 때보기 컨트롤러를 건너 뛰고 싶습니까? C에서 말하면서 B를 우회하여 a로 돌아갑니다. 그렇다면 다음을 참조하십시오. http://stackoverflow.com/questions/2944191/iphone-dismiss-multiple-viewcontrollers – vikingosegundo

답변

2

LOL 대답을 먹으 렴! 방금 답변을 게시했습니다.

ViewControllerthree *Controller = [[ViewControllerthree alloc] initWithNibName:@"ViewControllerthree" bundle:[NSBundle mainBundle]]; 

    Controller.Title = [item objectForKey:@"Title"]; 
UIViewController *rootController = 
    [[ViewControllerOne alloc] 
    initWithNibName:@"ViewControllerOne" bundle:nil]; 

    navigationController = [[UINavigationController alloc] 
          initWithRootViewController:rootController]; 

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 
    [self.window addSubview:navigationController.view]; 
    [self.window makeKeyAndVisible]; 
[self.navigationController pushViewController:Controller animated:YES]; 
    Controller = nil; 

그리고 voila!

행운을 빕니다, 나단

0

"뒤로"버튼이 없으면 어떻게됩니까? 당신은 UIViewController 닫습니다?

는 "뒤로"버튼을 눌러 다음 사용 숨기려면

self.navigationItem.hidesBackButton = YES; 
관련 문제