P86 Lay Out the Nib File


#1

The book says (second paragraph under ‘Lay Out the Nib File’) to go into Xcode to create the AppController class.

Interface Builder Version 3.2.2 has a better way of doing this:

Make sure the Library window is open (Tools > Library or shift-Cmd-L) and that the Classes tab is selected. Choose NSObject in the list of classes. In the lower pane, with Inheritance selected, use the gear wheel pop-up menu to make a New Subclass and name it AppController, making sure that the option to Generate Source Files is selected.

Now create an Outlet on the Outlets tab with the name textField and type NSTextField, then on the Actions tab create the two Actions sayIt: and stopIt: both of type id and then use the gear wheel pop-up menu to Write Updated Class Files.

Now you can drag your blue AppController cube into the doc window with its class already set. When you go into Xcode, you will find that the AppController.h and AppController.m files both have the text already inserted.

Interface Builder Version 3.2.2 does not have the AppController Identity layout as shown at the top of page 87 in Fig 5.10. The Class Actions and Class Outlets sections are now part of the Library window.


#2

[quote=“AndrewW”]
Interface Builder Version 3.2.2 does not have the AppController Identity layout as shown at the top of page 87 in Fig 5.10.[/quote]
Yes it does. I’m using XCode 3.2.2 with InterfaceBuilder 3.2.2, and in Xcode when I click on MainMenu.xib (in the Resources folder), IB starts up and five windows open:

  1. The Library panel on the left.
    2, 3, 4) The floating menu bar, app window, and MainWindow.xib tiled down the middle.
  2. A panel on the right, mirroring the Library panel on the left.

The righthand panel has 6 tabs. The 6th tab is the “Identity Inspector”. So if you drag an Object from the Library to MainWindow.xb, and you make sure the new object is selected(has the focus), you can click on the 6th tab in the the righthand panel, and the Identity Inspector will be shown. If you then enter the name “AppController” next to where it says “Class”, then the Identity Inspector’s title bar will change from “Object Identity” to “App Controller Identity”–just like shown in the picture on the top of p. 87.

You can also activate the Identity Inspector by going to IB’s menu bar and selecting Tools>Identity Inspector.