0

I'm developing a TabBarController application in iPhone. In the First tab (Lets Say Tab1), I navigate the viewControllers for example (view1, view2, view3), now I'm on view3 of Tab1, then I switch the tab and do some work there. Now when I get back to Tab1, I'm on view3, but I want Tab1 at view1 position.

Brian Diggs
  • 57,757
  • 13
  • 166
  • 188
Arsalan
  • 3
  • 1
  • We could probably help you if you posted some code. How do you set up the tab bar controller? – Erik B Mar 29 '11 at 13:25
  • [self.navigationController pushViewController:myTabBar animated:YES]; Connected the navigationController to the tab's navigation item in NIB – Arsalan Mar 29 '11 at 13:28

1 Answers1

0

I'll sum it up, as I understood it:

Architecture:

  • TabBar

    • ViewController1

    • ViewController1.1

      • ViewController1.1.1
    • ViewController2

    • ViewController3

So now you do the following:

ViewController1 -> ViewController1.1

ViewController1-1 -> ViewController1.1.1

ViewController1.1.1 -> ViewController3

ViewController3 -> ViewController1

and ViewController1.1.1 is displayed?

If so, just include the following in ViewController1.1 AND ViewController1.1.1

- (void) viewWillDisappear:(BOOL)animated
{    
    [super viewWillDisappear:animated];
    [self.navigationController popToRootViewControllerAnimated:YES];
}
Lepidopteron
  • 6,056
  • 5
  • 41
  • 53