Xcode 3, problem creating Core Data UI via drag and drop

  • (cross-posted from xcode-users)

    Hi,

    I'm using Xcode 3 on 10.5.1. I have created a Core Data Application
    (not a document app) via Xcode, and am trying to drag an entity from
    my model to the app's window in IB.

    I end up with a black square, both in IB and when I compile and run my
    application. I think the black square is the NSCollectionView.

    What does this mean?

    Thanks,
      Tom
  • On Nov 19, 2007, at 6:40 PM, Tom Davies wrote:

    > (cross-posted from xcode-users)

    Thanks, this is the right place for your question.

    > I'm using Xcode 3 on 10.5.1. I have created a Core Data Application
    > (not a document app) via Xcode, and am trying to drag an entity from
    > my model to the app's window in IB.
    >
    > I end up with a black square, both in IB and when I compile and run
    > my application. I think the black square is the NSCollectionView.

    What do you answer to the questions walking you through the type of
    interface you want to create for your entity?  One of the options is
    to create an interface based on NSCollectionView, but that's only one
    of the options available.

    Also, you can drag a "Core Data Entity" directly from the Library in
    Interface Builder 3 into your interface, and IB will walk you through
    choosing an entity from a data model in an open project, choosing the
    type of interface to create, what properties to show in that
    interface, and so on.

      -- Chris
  • On 20/11/2007, at 2:52 PM, Chris Hanson wrote:

    > On Nov 19, 2007, at 6:40 PM, Tom Davies wrote:
    >
    >> (cross-posted from xcode-users)
    >
    > Thanks, this is the right place for your question.

    Good to know -- I wasn't sure exactly where it fell.

    >
    >> I'm using Xcode 3 on 10.5.1. I have created a Core Data Application
    >> (not a document app) via Xcode, and am trying to drag an entity
    >> from my model to the app's window in IB.
    >>
    >> I end up with a black square, both in IB and when I compile and run
    >> my application. I think the black square is the NSCollectionView.
    >
    > What do you answer to the questions walking you through the type of
    > interface you want to create for your entity?  One of the options is
    > to create an interface based on NSCollectionView, but that's only
    > one of the options available.
    >
    > Also, you can drag a "Core Data Entity" directly from the Library in
    > Interface Builder 3 into your interface, and IB will walk you
    > through choosing an entity from a data model in an open project,
    > choosing the type of interface to create, what properties to show in
    > that interface, and so on.

    Perhaps I should go through the document oriented Core Data tutorial
    first, but I don't actually want a document based app.

    The steps I follow are:

    (Xcode) File, New Project..., Core Data Application, Next, type name
    "X", Finish.
    Open X_DataModel.xcdatamodel, Add Entity, set name to "Foo", Add
    Attribute, set name to "bar", type NSString, not optional.
    Click 'Build', build succeeds.
    Open MainMenu.nib
    (IB) Open "Window"
    (Xcode) Alt-drag "Foo" icon to IB "Window" window.
    (IB) "New Core Data Interface" dialog opens. Choose Collection view,
    select "Box" but not "Search Field", click Next Leave "bar" property
    selected, click Finish.
    Window displays a black square.

    The Window hierarchy is NSWindow -> NSView -> NSScrollView ->
    NSCollectionView

    Thanks for any guidance -- would it help if I made a zip of the
    project available to download?

    Regards,
      Tom
  • On Nov 20, 2007, at 2:40 AM, Tom Davies wrote:
    > Perhaps I should go through the document oriented Core Data tutorial
    > first, but I don't actually want a document based app.
    >
    The "creating the user interface" part is the same whether or not it's
    a document-based application.

    > Window displays a black square.
    > The Window hierarchy is NSWindow -> NSView -> NSScrollView ->
    > NSCollectionView
    >> [...]
    > I end up with a black square, both in IB and when I compile and run
    > my application. I think the black square is the NSCollectionView.
    > What does this mean?
    >
    It means the primary colour of the collection view (as shown in the IB
    inspector for the view) is black.
    Why is this a "problem"?
    Do you want to use a collection view?  What are you trying to achieve?

    mmalc
  • On 21/11/2007, at 12:17 AM, mmalc crawford wrote:

    >
    > On Nov 20, 2007, at 2:40 AM, Tom Davies wrote:
    >> Perhaps I should go through the document oriented Core Data
    >> tutorial first, but I don't actually want a document based app.
    >>
    > The "creating the user interface" part is the same whether or not
    > it's a document-based application.

    Good to know, thanks.

    >
    >
    >> Window displays a black square.
    >> The Window hierarchy is NSWindow -> NSView -> NSScrollView ->
    >> NSCollectionView
    >>> [...]
    >> I end up with a black square, both in IB and when I compile and run
    >> my application. I think the black square is the NSCollectionView.
    >> What does this mean?
    >>
    > It means the primary colour of the collection view (as shown in the
    > IB inspector for the view) is black.
    > Why is this a "problem"?
    > Do you want to use a collection view?  What are you trying to achieve?

    I was expecting to get a CRUD UI like that in "NSPersistentDocument
    Core Data Tutorial" Figure 2-4.

    I've subsequently gone through the tutorial with a Core Data Document
    based project, and I get the same (to me) unexpected result (the only
    modification I made to the tutorial was to create only one entity with
    only two attributes)

    I will learn to do this from first principles, but I thought the
    automatically created UI would be a useful starting point.

    Thanks,
      Tom
  • On Nov 20, 2007, at 6:21 PM, Tom Davies wrote:

    >> Do you want to use a collection view?  What are you trying to
    >> achieve?
    >
    > I was expecting to get a CRUD UI like that in "NSPersistentDocument
    > Core Data Tutorial" Figure 2-4.
    >
    You should create a "Master/Detail View", not a "Collection View".
    The NSPersistentDocument Core Data Tutorial is updated (for Xcode 3
    etc.) in the next documentation release.

    mmalc
  • On 21/11/2007, at 1:43 PM, mmalc crawford wrote:

    >
    > On Nov 20, 2007, at 6:21 PM, Tom Davies wrote:
    >
    >>> Do you want to use a collection view?  What are you trying to
    >>> achieve?
    >>
    >> I was expecting to get a CRUD UI like that in "NSPersistentDocument
    >> Core Data Tutorial" Figure 2-4.
    >>
    > You should create a "Master/Detail View", not a "Collection View".
    > The NSPersistentDocument Core Data Tutorial is updated (for Xcode 3
    > etc.) in the next documentation release.

    I should have tried that -- lack of curiousity killed the cat -- thank
    you very much!

    Tom
  • On Nov 20, 2007, at 2:40 AM, Tom Davies wrote:
    > (IB) "New Core Data Interface" dialog opens. Choose Collection view,
    > select "Box" but not "Search Field", click Next Leave "bar" property
    > selected, click Finish.
    > Window displays a black square.
    >
    > The Window hierarchy is NSWindow -> NSView -> NSScrollView ->
    > NSCollectionView

    Ah, the problem is that it's doing exactly what you asked for -- it's
    creating an NSCollectionView because you've asked for a collection
    view.  You'll want one of the other views for your data if you want a
    form-style interface.

      -- Chris
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today