简体   繁体   中英

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?

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

[self.navigationController popViewControllerAnimated:YES];

This would get the UINavigationController that the UITabBarController is in.

[tabController.view removeFromSuperview];

[self.navigationController popToRootViewControllerAnimated:YES];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM