简体   繁体   中英

Tab bar disappears after push back to a view controller of the tab bar

I have a tab bar controller with four view controllers. In the second view controller I have a table view. Now when the user tabs on a cell of the table view, I do a push to another view controller. When I now tab on my button "back" I do a push segue to the table view again, but somehow my tab bar disappears . I did every push in my storyboard, no coding.

Do you have an idea, how I can solve that problem? Thanks for help.

You should never go back to a previous view controller with a segue, unless you use an unwind segue . When you do a push to "go back" to the table view, you're not really going back, you're creating a new instance, and that instance knows nothing about the tab bar controller. When you push to that other controller, you get a back button by default -- if you use that, it will call popViewControllerAnimated: which is what you want to do. If you really want to use a custom back button and a segue, then use an unwind.

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