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.
-
Nuri Hassim
-
Mark
-
Dustyn
-
cynik
-
Paul Robinson
-
SepSmoolo
-
Adam
-
Ben



