See More
Popular Forum

MBA (4887) B.Tech (1769) Engineering (1486) Class 12 (1030) Study Abroad (1004) Computer Science and Engineering (988) Business Management Studies (865) BBA (846) Diploma (746) CAT (651) B.Com (648) B.Sc (643) JEE Mains (618) Mechanical Engineering (574) Exam (525) India (462) Career (452) All Time Q&A (439) Mass Communication (427) BCA (417) Science (384) Computers & IT (Non-Engg) (383) Medicine & Health Sciences (381) Hotel Management (373) Civil Engineering (353) MCA (349) Tuteehub Top Questions (348) Distance (340) Colleges in India (334)
See More

How are the 2 View Controllers wired to the tabBarController in iPhoneRecipes

General Tech Learning Aids/Tools

Max. 2000 characters



( 5 months ago )


I am learning iPhone programming by reviewing the iPhone Recipes sample application.

I am puzzled with how the two view controllers are wired to the tab bar. If they are wired in the XIB, can anyone explain how it is done or where I can get more visually aided details on connecting things in the XIBs.

This is my starting point in the learning process:

- (void)applicationDidFinishLaunching:(UIApplication *)application {
 recipeListController.managedObjectContext = self.managedObjectContext;
 [window addSubview:tabBarController.view];
 [window makeKeyAndVisible];



( 5 months ago )


Basically, the view property of the tab bar is being added as a subview of the window.

The view property of the tab bar points at the tab bar's visual component, (the tab bar view itself) and the tab bar controller handles its behaviour (changing tabs, etc).

Each individual tab is a subview of the tab bar, so when the tab bar view is added as a subview of the window, its subviews are brought along for the ride. It's a little tricky to get your head around at first, but it should start sinking in after youplay around with interface builder a bit more.

All that's happening in the XIB is you're setting the view outlets on each tab so that they can be displayed when each tab is selected.

Hope this helps.

what's your interest