Load all tab bar views when application first runs
I have开发者_开发问答 a tab bar controller with 4 separate views. When I navigate from the first view to the second view, it takes some time to load up the second view.
What I want to do is, be able to load and initialise all of my tab bar views during my splash screen. That way, when the user navigates between the tab views, there is no wait time.
how do I manually initialise my individual tab bar views in my app delegate?
To load a tab view programmatically, e.g. in application:didFinishLaunchingWithOptions:
you can:
// load the third one, for instance
thirdNavController = [tabBarController.viewControllers objectAtIndex:2];
[thirdNavController.topViewController loadView];
I think accessing the view property of each of your controllers will cause it to be loaded (lazy loading). Though I don't think you can have an absolute guarantee it won't get unloaded before you use it if memory is tight.
精彩评论