I'm following a tutorial on how to use Interface Builder from Chapter 2 of Zdziarsky's "iPhone SDK Application Development." The idea appears to be to create a very basic app which consists of a Tab Bar Controller which has two buttons, each tied to a different view object (and each view object in its own respective .xib file). What I end up with is a blank window and some code that's significantly different from what the book indicates I should have.
I suspect a missing step, but the instructed steps are scattered across a chapter of explication, so I'm not 100% sure I've haven't missed something. Here's a summary of what the steps appear to be:
- Create a new "window-based application" named "Example."
- Open MainWindow.xib in Interface Builder and do the following: a) Select the "Window" icon in the document window, open the inspector, set various extraneous properties. b) Drag a "Tab Bar Controller" into the document window. c) Edit the two tab names to "Recents" and "History." d) Save MainWindow.xib
- Create a new "Cocoa Touch View" IB template. Add a "Table View" to it. Save it as Recents.xib.
- Similarly, create another "Cocoa Touch View" IB template. Add a "text view" to it, save as History.xib.
- Go back to MainWindow.xib, edit each of the tabs in the Tab Bar Controller in the Inspector so that the "Nib Name" corresponds to the appropriate .xib file created in step 3 (for Recents) and step 4 (for History).
- Add Recents.xib and History.xib to the project "Example."
At this point, the book says that if I look at ExampleAppDelegate.h, I should see links to the Interface Builder objects in my code, such as:
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet RootViewController *viewController;
When I actually look at the file, though, I only see the first (UIWindow) line above. The RootViewController line is absent.
Similarly, the book says that when I look inside of ExampleAppDelegate.m, I should see some synthesize directives:
@synthesize window;
@synthesize viewController;
But again, I only see the line relevant to window.
And sure enough, if I click "Build and Go," what I see in the simulator is an empty window.
One of the things I noticed while going through this process was that I wasn't instructed to drag the Tab Bar Controller from step 2b directly into the displayed Window object in the interface builder. I tried to do this anyway and found that I wasn't allowed to (and in fact, that view controllers of any kind didn't seem welcome directly in the Window). This seemed odd to me -- I noticed that directly dragging a View object into the Window seemed OK. But since Views can't contain View Controllers, I can't see how you're ever supposed to add a View Controller inside of a heirarchy contained in a Window.
What steps and/or pieces of knowledge am I missing here?