Search code examples
iphoneiosuinavigationcontrolleruitabbarcontrollerrootview

Navigation issue


I want navigate to Rootview of 1st Tabbar item by clicking a button on fourth tabbar using this code just changes the Tabbar selection

code snippets

[self.parentViewController.tabBarController setSelectedIndex:0];

Previous action to be appear in the home view controller .

i need Direct navigation of Home view controller in main page

How to resolve in this issue?

Thanks in advance


Solution

  • First get your UINavigationController of the first tabbar item.

    UINavigationController *navController = [self.tabBarController.viewControllers objectAtIndex:0];
    

    And then navigate to root view controller.

    navController popToRootViewControllerAnimated:NO];
    

    That's all. :)