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

General Tech Learning Aids/Tools 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years 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];
}
profilepic.png
manpreet 2 years 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.


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.