Closed batkov closed 8 years ago
Feature presented on iOS 4.3, but not on iOS 5
I have the same problem. Since I need a call of viewDidAppear I added notification into the end of - tabBar:didSelectTabAtIndex: (BCTabBarController.m)
if ([[[UIDevice currentDevice] systemVersion] compare:@"5.0" options:NSNumericSearch] == NSOrderedAscending)
{
[[NSNotificationCenter defaultCenter] postNotificationName:kTabChangedNotification object:self userInfo:
[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:index] forKey:@"index"]];
}
in BCTabBarController I think we need this.. fixes it for me when I'm using navigationControllers
- (void)setSelectedViewController:(UIViewController *)vc {
UIViewController *oldVC = selectedViewController;
if (selectedViewController != vc) {
selectedViewController = vc;
if (!self.childViewControllers && visible) {
[oldVC viewWillDisappear:NO];
[selectedViewController viewWillAppear:NO];
if ([selectedViewController isMemberOfClass:[UINavigationController class]]) {
UINavigationController *navController = (UINavigationController *)selectedViewController;
[navController.topViewController viewWillAppear:NO];
}
}
self.tabBarView.contentView = vc.view;
if (!self.childViewControllers && visible) {
[oldVC viewDidDisappear:NO];
[selectedViewController viewDidAppear:NO];
if ([selectedViewController isMemberOfClass:[UINavigationController class]]) {
UINavigationController *navController = (UINavigationController *)selectedViewController;
[navController.topViewController viewDidAppear:NO];
}
}
[self.tabBar setSelectedTab:[self.tabBar.tabs objectAtIndex:self.selectedIndex] animated:(oldVC != nil)];
}
}
ViewWillAppear, ViewDidAppear, ViewWillDisappear ViewDidDisappear methods not called in selectded view controller and not called into BCTabBarController. This problem appears after BCTabBarController show modal controller from instance of BCTabBarController class.