I am working on making a tabbed app. It has a TabBarController and 4 ViewControllers attached to it.
By default, at launch only FirstViewController
is loaded. I would like to load both FirstViewController
and SecondViewController
at start before switching to the second view via tab menu.
What i tried so far is that I created custom MyTabBarController
class and tried to use
var sv = SecondViewController()
sv.loadView()
in ViewDidLoad()
, but it caused a fatal error during loading, because (my guess) mapView element from storyboard was not loaded.
What is the correct way to simultaneously load the two viewControllers which use storyboard elements? All my other tries have not been successful so far.
Add in your main view controller
And in your viewDidLoad:
That's it. When you want to present it, use: