Jamie McAllister
Jamie McAllister

Reputation: 729

ios back button from a tab bar view controller

this is probably a very simple solution, i am writing an app for iphone that helps people manage their medication for fibromalyosa (i spelt that wrong i think....)

the first view controller of the app is a main menu (which is another problem for another question about collection views)

the menu is embedded in a navigation view controller with the navigation bar hidden to stop the menu looking squashed

the first item of the menu pushes a tab bar view controller with 3 tabs in it (each tab has a view controller)

so here's my question:

how do i implement a back button on all 3 tabs that will send the user back to the main menu?

Upvotes: 0

Views: 1071

Answers (2)

Virat
Virat

Reputation: 3

[tabController.view removeFromSuperview];

[self.navigationController popToRootViewControllerAnimated:YES];

Upvotes: 0

Felipe Cypriano
Felipe Cypriano

Reputation: 2737

From you controllers inside the tabs you can call popViewControllerAnimated::

[self.navigationController popViewControllerAnimated:YES];

This would get theUINavigationController that the UITabBarController is in.

Upvotes: 1

Related Questions