In the interface builder I have a UITabBarController
and it is set as the initial view controller. From the tab bar controller, I have linked three independent ViewControllers; two UIViewController
's and one UITableViewController
. I have embedded all three of these views inside UINavigationController
's as each of these views will eventually segue to a new view.
Interface Builder
Problem:
I now want to link one of the UIViewController
's to the UITableViewController
using a button to segue to the table view. This way I can pass information, i.e. func prepareForSegue()
, to the table view. I want to maintain the tab bar controller at the bottom, however I do not want to have the ability to go back to the previous UIViewController
from the current UITableViewController
via a UIBarButtonItem
at the the top of the view; That is what the tab bar at the bottom is for.
However every time I segue "Show" the table view (it is actually a segue to the table views navigation controller), the navigation bars at the top and the bottom of the table view disappear. Is there anyway to prevent this from happening?
I have also tried segue "Show" directly to the table view, in which case the tab bar is visible, but then it displays a "back" button at the top of the view to segue back to the sending UIViewController
. I am hesitant about accepting a solution that would just hide the back button, because I feel I will run into problems down the road when I want to navigate to a detail view from the table view itself, since I would be bypassing the UITableViewController
's UINavigationController
.
Any solutions would be greatly appreciated. I have been trying to solve this problem for hours and I'm about to put my head through my computer screen. Also I thought about just using tabBarController?.selectedIndex
on the button click to shift to the table view, and then passing the information using NSUserDefaults
, but this is out of the question since I would be passing a custom object, and would have to encode and decode every custom field.