Interface Builder 3 and Creating Classes

Apple made many changes with the release of XCode 3 and Interface Builder 3 with the OS X Leopard operating system for the Mac. The workflow for these toolsets is very good as to be expected. With the release of these latest versions they aimed to provide an even more strict bound toolset to the ideals of the MVC paradigm.

In previous versions of Interface Builder, whilst creating your views for your application, you could quickly create a subclass of an existing object, say NSObject, by clicking the "Classes" tab and Control-clicking a class to subclass it into your own custom class. Apple realized this was probably not the best form as it allowed you to basically be creating part of the model within the wrong part of the IDE. The model should be created within XCode itself where all the other classes are developed. In Interface Builder 3, you can no longer subclass. You need to go back to XCode and create your class there, then when you go into Interface Builder, drag a generic Object/ObjectController and drop it in your nib. From there, inside the Inspector under Name, start typing the name of the custom class you created in XCode and push return after it has auto-completed. This will in turn apply the parent class to your custom class.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Good post - that had me stuck for a while too when I moved to Xcode 3. To add to the problem most tutorials do it the old fashioned way :-/
# Posted By rob | 4/24/08 1:41 PM
That's just it, I was working from a book that was a couple of years old.
# Posted By Kyle Hayes | 4/24/08 2:20 PM