그래서 여기에 문제가 있습니다. 내가 UINavigationController가 스택에 푸시 된 UIViewController에의 부모 컨트롤러를 검색하기 위해이 코드를 사용하고 있습니다 :여러 개의 UINavigationController가있는 UITabBarController의 UINavigationController 스택에 뷰 컨트롤러 가져 오기
MyAppDelegate *delegate = [[UIApplicationDelegate sharedApplication] delegate];
UINavigationController *nav = delegate.navigationController;
MyParentViewController *parent = (MyParentViewController *)nav.topViewController;
parent.myProperty = @"propertyValue";
그러나, 이것은 당신이 하나의 탐색 컨트롤러를 사용하여 응용 프로그램으로 작업하는 경우에만 작동하는 것 같다. 내 구조는 :
->UITabBarController
-->UINavigationController
--->MyYetAnotherParentViewController
-->UINavigationController
--->MyOtherParentViewController
-->UINavigationController
--->MyParentViewController
즉, 3 개의 내비게이션 컨트롤러가 탭 바 컨트롤러 안에 있음을 의미합니다.
현재 세 번째 내비게이션 컨트롤러에 있으며, MyParentViewController 위에 뷰 컨트롤러를 밀어 넣었습니다.
UIViewController에서 데이터를 전달하려고하는데 속성을 사용하여 MyParentViewController에 푸시했습니다. 이 설정을 사용하면 스택에 푸시 한 UIViewController의 부모를 어떻게 검색합니까?