Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6816795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:58:07+00:00 2026-05-26T20:58:07+00:00

I have a TabBar controller with up to 9 controllers, each one has a

  • 0

I have a TabBar controller with up to 9 controllers, each one has a navigation controller. Currently, I alloc and init each one of them within the app delegate in the

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{...}

This makes my app take quite some time to start when first started. I’d like to reduce the initial loading time with lazy initialization.

Is there a way to “lazily” init view controllers when they are first selected for the tab bar?

Will looking into storyboards for iOS5 help me with this issue?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:58:07+00:00Added an answer on May 26, 2026 at 8:58 pm

    What about defining your controllers as lazy controllers?

    I mean, if the app takes some time to start due to initialization of nine view controllers, then this has to do with what the controller actually do at init time. So, you could make the controller lazily init in two steps: one, when you add all of your controllers to the tab bar controller; two, when you select a specific tab, then the corresponding controller gets initialized.

    I think this is the cleanest approach.

    Otherwise, I would bet on directly using UITabBar to manage it in your own tab bar controller class.

    As a last option, I would try and change on the fly the content of the tab bar controller by calling setViewControllers:animated: at appropriate times according to some logics. For example, you could initialize the tab bar controller with only 5 view controllers in application:didFinishLaunchingWithOptions:, then add the rest at a later moment…

    But my actual suggestion is making the component controllers lazy…

    EDIT: after reading your question in the comment…

    if you would give a try to lazy initialization of your controllers, what I mean is following:

    1. you will initialize your controllers (or UIKit will when loading the nib) by calling [[… alloc] init…]; this is not changing;

    2. the init method will initialize the controller to its default state, like setting properties and ivar values, and do nothing more complex;

    3. before the controller view gets displayed, you complete its initialization by calling a specific method; this would carry through the “quite a lot of delegation” part, which I assume to be the lengthy part of initialization.

    Sorry if talking about “lazy initialization” caused an ambiguity between the logical initialization of the component and the content of the initmethod.

    As to point 3, you have several options about where to complete the initialization.

    On possibility is when the controller is about to be displayed. In this case, either you define -tabBarController:didSelectViewController: in the tab bar controller delegate, or you use viewWillAppear. This will give you the laziest initialization of all, but it could be add some delay on the exact moment when you select the tab before the view appears.

    Better yet is using viewDidLoad, which would give you a kind of less lazy initialization; the initialization of all your controllers would happen at some point in time that you do not control (of course, before the view is displayed), so it might delay things a bit, but it would not happen in applicationDidFinishLoading and would be more UI-friendly since it would be controlled by the main loop. Definitely, the first option to try. Give also a look at the description of viewDidLoad in the UIViewController reference.

    Finally a note about the separate thread. Keep in mind that is not all safe using UIKit from a separate thread, so be careful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the thing. I currently have a tabBar controller, with several navigation controllers
I have 6 view controllers on a UITabBarController. Each of them has a UINavigationBar
I have tabbar - two tabs with navigation controller in each. On second card
I have an app consisting of a TabBar with a few TabBarControllers. One Controller
I have a tab-bar and navigation controller application (like Youtube app or Contacts app).
My app flow requires Navigation and TabBar controller. So I decided to use TabBar
I have an app which has UITabBar with 5 views, each attached to a
I have 2 tab bars in a tabbar controller, each with a nav controller.
I am currently developing an app that has a TabBarController and each of the
I have TabBar View combined with Navigation View. Structure like this: delegate -> TabBar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.