그래서, 나는 tabbarcontroller가 있고, tabBarItem
을 건 드리면 dismissModalViewController
에 알림을 전달합니다.NSNotification 문제 및 모달보기 컨트롤러 해제
잘 작동하고 모달 뷰 컨트롤러가 닫힙니다. 하지만 특정 방식으로 변경하고 싶습니다. 예상대로 작동하지 않습니다 ...
알림을 게시하기 전에 옵저버를 초기화했습니다. 이들은 tabBarItems 있습니다 -
NSArray *viewControllerss = [[NSArray alloc] initWithObjects: myProfileDataViewController,
sampleViewController,reminderInfoViewController, nil];
[self.tabBarContr setViewControllers:viewControllerss animated:YES];
self.tabBarContr.selectedIndex = 2;
나는 sampleViewController
의 viewWillAppear
에 알림을 보내고 나는 tabBarIcon이는 TabBarController를 일축 것을 선택할 때.
하지만 UITabBar
의 왼쪽에 sampleViewController
을 가장 넣고 싶습니다.
그리고는 그래서
NSArray *viewControllerss = [[NSArray alloc] initWithObjects: sampleViewController,
myProfileDataViewController, reminderInfoViewController, nil];
본 닫지 않습니다 탭 표시 줄 컨트롤러처럼 추가합니다.
참고 :가있는 NSArray가 초기화되는 순서를 참조하십시오.
통지는 통지를 게시 직전
전 항상 NSLog를 사용하고 있습니다. 알림이 전송되고 관찰자가 준비되었습니다. 모달보기'sampleViewController'가 배열 – Legolas
에 처음 추가 될 때 해제되지 않습니다. NSLog의 출력을 얻었습니까? 탭 사이를 전환하면 viewWillAppear 메서드가 트리거되는지 궁금합니다. – Zhang
예, viewWillAppear을 트리거하지 않았습니다. – Legolas