Reputation: 3691
With reference to this link I added UITabDelegate
and UITabBarControllerDelegate
in AppDelegate.h
and added
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
if ([viewController isKindOfClass:[UINavigationController class]])
{
[(UINavigationController *)viewController popToRootViewControllerAnimated:NO];
}
}
in AppDelegate.m
. Still the issue is not solved. I am using XIB in my project and handling login and logout to enable and disable tab bar accordingly.
Upvotes: 0
Views: 638
Reputation: 4671
You should write this:
if ([viewController isKindOfClass:[ClassName_Of_Selected_ViewController class]])
{
//[(UINavigationController *)viewController popToRootViewControllerAnimated:NO];
[viewController.navigationController popToRootViewControllerAnimated:NO];
}
Upvotes: 2