I have a UIViewController, call this ViewControllerB
, which I am attempting to push from ViewControllerA. ViewControllerB
has a ton of custom UI from libraries (calendar, segmented controls, etc), as well as a UIPageViewController with tableViews.
I noticed that there is a 1-3 second delay when I push ViewControllerB
, and upon using time profiler, I am able to trace it to blockage of the main thread due to setting up these UI in viewDidLoad. So it appears that the app needs some time to set up UI before pushing the view controller.
What is the best way to set up a ton of UI but avoid blocking the main thread when pushing view controllers?