开发者

How do I automatically generate a Core Data GUI in Xcode 4?

开发者 https://www.devze.com 2023-03-20 13:17 出处:网络
I am working my way through Learn Cocoa on the Mac which was written based on Xcode 3, and I am using v4. So far I have been able to fairly easily find my way around the differences, but now I am on a

I am working my way through Learn Cocoa on the Mac which was written based on Xcode 3, and I am using v4. So far I have been able to fairly easily find my way around the differences, but now I am on a chapter introducing Core Data and there's a part about being able to automatically generate a GUI by Option+dragging from an entity to a window in IB, but I don't seem to be able to do this in Xcode 4. Is it still possible, or did that ability die with v3? And more importantly, how do I do this?

This are the instructions in the book:

Start by going back to Xcode’s navigation pane. Go into the Resources group and double-click MainMenu.xib to open it in Interface Builder. This brings up a nib file much like you’ve seen in earlier, including a menu and an empty window. Bring the empty window to the front (double-click on its icon in the main window if the window isn’t showing), and make it a bit bigger; somewhere about 500 x 600 will do nicely.

Now go back to Xcode, and bring up your model file if it isn’t still showing. What you’re going to do is ⌥-drag the MythicalPerson entity from the graph paper workspace over to the blank window in Interface Builder. Start by holding down ⌥, then click and hold开发者_开发问答 on the box representing the MythicalPerson entity. Keep holding the mouse and drag away, and you’ll see a translucent copy of the entity box being pulled along with your mouse pointer. Once the drag is started, you can release the ⌥ button. Now drag the entity over the empty window in Interface Builder. If you can’t see it, use ⌘Tab to switch back to Interface Builder (while still holding down the mouse button!), drag over the middle of the empty window, and release the mouse button.

Now you’ll be presented with the New Core Data Entity Interface assistant

Any hints? Thanks!


If anyone is struggling with chapter 7 because of the removal of the Core Data Interface Assistant from XCode 4 then follow the guide here to get you back on track: http://www.swampfoetus.net/chapter-7-fail/


I had this problem a while ago too when trying to follow an Xcode 3 core data tutorial in Xcode 4. After asking here and dragging Entities in many different ways it would seem that the only conclusion we were able to draw was that Apple's removed the Core Data Entity Interface Assistant in Xcode 4. There's two possible solutions to this, have an alternative installation of Xcode 3 on your computer too and use this to generate the GUI and then do the rest of your work in Xcode 4(which isn't particularly practical) or create the GUI by hand and use bindings to set it up. Apple provides a great tutorial on that here, if you are not sure how to go about that

0

精彩评论

暂无评论...
验证码 换一张
取 消