Modify (Storyboard)TabBarController tabs before th

2019-08-29 04:08发布

问题:

So my app decides at runtime which TabBarItems are available. Problem is, [self.tabBarController viewControllers] is empty in the actual TabBarController class (in viewDidLoad and viewWillAppear that is). It is filled after the first ViewController (tab) did load, but that is too late as i dont even know if i want to load this particular one.

I know this can be solved by dumping storyboard, is it possible relying on it too?

Best solution that comes to mind so far is creating a dummy ViewController that gets swapped out immediately after loading is done...

回答1:

It's empty because the tab bar controller doesn't have a tabBarController property. It should just be self.viewControllers.