0
votes

I am attempting to create a basic tab-bar application using interface builder. I create a new project in Xcode selecting tab bar application.

My question is how can I access the code that instantiates and pushes each of the views when the tab bar buttons are pressed? I would imagine that would be done by the tab bar controller, however when I write the class file from interface builder (file>write class files), it just creates a blank generic TabBarController.h/TabBarController.m without the methods for pushing each of the views associated with the tab bar elements.

I ask this because I would like to pass each view controller a reference to the data model when they are instantiated. Any help would be greatly appreciated, thanks.

1

1 Answers

0
votes

You're not missing any hidden code because there simply isn't any. Interface Builder is not a code generator. When you put objects into a NIB file in IB, IB archives them and your app unarchives them when it loads the NIB.

So assuming you have created the tab bar controller with all its subcontrollers in MainWindow.xib, all these objects will have been instantiated when your code reaches application:didFinishLaunchingWithOptions:.