Giving the Simple Text Editor 'Legs'
Subject:   Using the December 2001 DevTools
Date:   2002-03-12 08:46:09
From:   spiffyman
First of all, great tutorial. I've got very little experience in C++ (that is, I've yet to even study classes), but this gives a very clear account of Objective-C and really does show how easy to use the PB/IB Tools are.

However, as mentioned in a thread earlier, the December '01 DevTools are subtly different from the version used in the tutorial. I worked a lot on it, though, and my app seems to be working just fine. So here's how I got it done:

When, in Interface Builder, we're supposed to add a new Outlet to MyDocument, but the interface is different in the new DevTools. When you click on the Classes tab for MyDocument.nib, one of the classes is NSObject. Click on that. In that menu is NSDocument, and MyDocument can be found there. Click on MyDocument, then choose 'Show Info' from the Tools menu (or hold shift-command-I).

In the resulting window, make sure "Attributes" is in the pop-up menu at the top. At the bottom you should see a list of Outlets, one of which is named myOutlet. Change the name of that to textView (leave the type as id).

Now do the rest of the Interface Builder section as Mike so expertly wrote it. Any differences are so subtle I didn't notice them. One word of caution, though: make sure the Show Info palette is showing "File's Owner Info" as opposed to "NSScrollView Info" (this can happen if you've accidentally deselected your File's Owner connection and have now selected the window itself).

Back in the Project Builder, the Classes tab is not the way you want to go. The MyDocument listed in that tab, if clicked, will only lead you to MyDocument.m, and there's some editing to do in MyDocument.h. To fix this, stay in the Files tab and click the arrow to the left of "Classes" -- that should show both MyDocument.h and MyDocument.m for your editing pleasure. Continue with the tutorial as Mike wrote it. Another word of caution: when editing MyDocument.h, be sure to put a semicolon (";") after the lines "id IBOutlet textView" and "NSData *fileData." I don't think Mike said to do this (if he did, I missed it and don't feel like checking right now). When you build and run the project, it'll tell you you need them, but why wait until then?

Again, thanks, Mike for a great tutorial. No problems (beyond the DevTools differences) thus far, and that's saying a lot.