2013-01-21 4 views
0

나는 내 아이폰 OS 아이 패드 응용 프로그램에 다음과 같은 구조를 가지고 :실제 뷰 컨트롤러를 변경하는 올바른 방법은 무엇입니까? 로드 뷰의 부모에 제시하고 presentingViewController가 null 인

  • RootViewController :
    • @property의의 UITabBar 로그인을 * 주 (성공 로그인 후로드되는) ;
    • appDelegate

나는 두 가지 속성이 있습니다 창 로그인. 첫 번째에는 UIWindow을로드하고 다른 하나는 LoginViewController (UIViewController)에로드합니다. 그리고 RootViewController로 로그인을 설정하십시오.

로그인했을 때 MainController (확장 UITabbarController)으로 입력 된 "main"이라는 속성이 있습니다.

은 성공적인 로그인 후 나는 메인로드 위의 코드를 사용

[_main setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; 
[self presentViewController:_main animated:YES completion:nil]; 

MainController가있는 viewDidLoad 방법에로드되었다. 두 점 :

MainController의 대리인으로 설정해야합니까?

이것은 내 MainController의 viewDidLoad 방법의 시작이다 :

[super viewDidLoad]; 
[self setDelegate:self]; 
NSLog(@"Parent view controller is: %@", [self parentViewController]); 
NSLog(@"Presented view controller is: %@", [self presentedViewController]); 
NSLog(@"Presenting view controller is: %@", [self presentingViewController]); 

이의 로그는 다음과 같습니다

2013-01-20 21:23:53.180 MyApp[6304:11303] Parent view controller is: (null) 
2013-01-20 21:23:53.181 MyApp[6304:11303] Presented view controller is: (null) 
2013-01-20 21:23:53.182 MyApp[6304:11303] Presenting view controller is: (null) 

나는의 ViewController를 제시하는 올바른 방법을 사용하고 있습니까? 또는 버튼을 클릭하거나 로그인 한 후보기를 표시 하시겠습니까? 누락 된 항목이 있습니까? 뷰 계층을 올바르게 사용하고 있습니까?

표시 할 컨트롤러를 포함하는 속성이 필요합니까?

지금부터 감사하겠습니다.

답변

0

앱 위임자와 다른 컨트롤러에 대한 코드를 직접 작성 했습니까? 그렇다면 나머지 코드를 게시하지 않았기 때문에 내가 말할 수있는 모든 뷰 컨트롤러를 초기화하는 것입니다. 당신이 펜촉/XIB/스토리 보드 파일 다음

YourViewControllerNameHere = [[ViewControllerType alloc] initWithNibName:youInterfaceFileNameHereWithoutFileType bundle:nil]; 
+0

알렉스가있는 경우

YourViewControllerNameHere = [[ViewControllerType alloc] init]; 

또는, 내가 그들을 초기화. 그것들은 제대로로드되고 나타나기 때문에,''실행 중일 때 정의 된 parentViewController가 없습니다. –