Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

robvas

macrumors 68040
Original poster
Mar 29, 2009
3,240
629
USA
I'm trying to follow a Core Data chapter in a book, but I'm stuck at a difference between versions 3 and 4 of Xcode. I'm trying to drag an Entity object created in the core data modeler over to a view, but it the view won't highlight like it's going to accept the drag+drop.

The Automatic GUI

The developer tools have special support for Core Data, allowing you to quickly make a feature-rich GUI application for accessing your model objects through Core Data. This auto-generated GUI will let you create new objects, edit them, search for them, and delete them. And not only can you get that far without writing any code, you can even get a rough version of the GUI up and running with little more than a drag of the mouse. The GUI created by this process works entirely through Cocoa Bindings, using an NSArrayController just like you used for creating DungeonThing in Chapter 6. The key difference is that the NSArrayController created here will access its data through Core Data instead of through your own controller’s array (like we used in DungeonThing). In this section we’ll show you how to do this, and then in the next section we’ll show you how to tweak your GUI to make it even better.

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 ␣ 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 (see Figure 7– 5). This assistant lets you choose from a few different GUI templates, each with some options of its own. Select Master/Detail View from the popup list, and click to enable each of the Search Field, Details Fields, and Add/Remove checkboxes.

Any tips on doing that in Xcode 4?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.