Instantiating an Object in Interface Builder on Leopard
If you’re like me, you’ve began the transition to coding on Leopard. After giving XCode and IB a swirl, you’re going to want to get down to coding real stuff. After starting a new project and creating a a few classes in XCode you want to instantiate your controller object. When you open up Interface Builder, you go to the menu bar and try to find Instantiate Object. You won’t find it. This took me awhile to figure out. Where the hell did Apple put this? I want to instantiate my controller object. I can’t find out how. I finally did find it, and when a friend of mine asked me the same question about IB, I decided to write up this post to quickly explain it.
Apple has done away with the old way of instantiating classes completely. Now what you have to do is open your Library panel (cmd-shift-L). In the search box type NSObject. This will reveal two possible items. Drag the “Object” one into your project window.

You’ll then want to reveal the inspector on this object. Click the Object in your project and open the Inspector (cmd-shift-I). Select the second to right tab called Identity (circle with an “i” in it). Under Class Identity choose the class you want to instantiate.

You’ve now got your object instantiated in Interface Builder. Just a little reminder: You might need to synch IB with XCode to see your updated class files. Do this by going to File | Synchronize with XCode.
That’s all for this little tip. I hope this saved you a little frustration in the transition from Tiger to Leopard. If you have any other little tips about the transition, I would love to hear them. Please feel free to post in the comments.
6 Replies
Ben on 2/6/2008 at 16:43Thanks for this article, without it i would have given it up.
thanks :)
Adam on 2/12/2008 at 23:17Thanks!
SepSmoolo on 2/24/2008 at 09:37I am necessary wish to find
Paul Robinson on 2/24/2008 at 10:02Good post. This was far from obvious in XCode 3!
cynik on 3/12/2008 at 13:57Yeah, cheers. I actually did what this article says, before finding it, but until I read it I was still unsure if I had guessed right. Xcode 3 is very fucking far from intuitive.
Dustyn on 3/18/2008 at 22:43Holy crap. I just started trying to learn this and the book looked nothing like it. I was gonna give up n it. Thanks



