0
votes

I am trying to switch between two different tab bar item setups. When I go into a detailedView a want another set of tab bar items. And when I go back, i want to reset it again. So far so good.

I want to load the new setup of tab bars from a nib file, and thus have two different nib files including the view controllers I want to switch between.

And the plan is then to just set the new view controllers upon the tab bar controller object with setViewControllers.

The problem is that I am not able to fetch the view controllers from the nib file with the new setup (the nib file that is not loaded). The nib file containing the current setup of tab bar items is loaded and the viewcontrollers are fetched successfully.

How can I fetch the view controllers that is within my nib file?

1

1 Answers

0
votes

Create an IBOutletCollection property in the object that will load the nib with the second set of view controllers. Set that object's class as the type of the file's owner, and then you'll be able to connect multiple view controllers in the nib to the file's owner's outlet. Your outlet collection property will be an array, so you'll be able to set the tab bar's viewControllers property to that array. Of course, you'll probably want to keep a reference to the tab bar controller's original set of view controllers so that you can swap back later if necessary.