views:

103

answers:

2

I have an app that has four tabbar controllers views in it. When the app starts up, all four are loaded via SQL select statements. How do I tell it not to load these controllers at startup, but to do it when I select a value from the first screen?

thx wes

A: 

make simple UIViewController in tabbar, but when controller is selected do loading this

sakrist
A: 

I'm assuming you have 4 ViewController placed into a single TabBarController. If this is the case, why do you want to defer loading? The actual views (usually the 'heavy' part of the ViewController) are not loaded until you actually select one in the tab bar to bring it forward (which is, I think, the behavior you're looking for).

The whole point of the UIViewController class (well, one of the points, anyway) is to allow you to place your view in a hierarchy without having to create all the UI elements required until it's actually time to show it. This makes app organizations much easier.

Ben Gottlieb
I reviewed the MainWindows.xib file and see that the controllers within the Tab Bar Controller are Navigation Controllers. Does that make a difference?I only want an SQL statement to run when the tab bar is selected, not at startup.
Wes
You only want an SQL query to run, not a new view controller to be displayed? If that's the case, you don't want to use a UITabBarController, you want a simple UIViewController with a UITabBar. When a tab is selected, you can run your query and update the UI.
Ben Gottlieb
Okay, I will give that a try. I am also hoping to set the startup controller without any tabbars on it, select an item from a list and then go into these UIViewController with the UITabBars on it.
Wes