DRVic
DRVic

Reputation: 2481

Core data, bindings, NSArrayController and table views - how to generate a view of a core data context

I have a working system that lets me build a database containing instances of various entities , all linked together nicely.

Before I knew I would care, I came across a tutorial on using Core Data and bindings, and it went through a complete case where you get a table showing all the entities of some type with a column for each property. It showed both the UI side and the Data model side - not that I need the data model part at this point. Now, darned if I can find it. This is one of those things that is supposed to be easy, and requires virtually no code, but getting exactly the right connections in UIBuilder is not going to happen if I can't find instructions.

Also, I thought I came across an example of something like a query editor where the user could select which properties to sort on, which to match on, etc. Did I imagine that?

Anyone out there know where I can find such?

Upvotes: 1

Views: 1761

Answers (2)

DRVic
DRVic

Reputation: 2481

I found at least a partial answer to the query editor question, in this apple tutorial. Not sure how far it will get me, as I prefer to write code where possible, since then I can leave a trail of comments.

Upvotes: 1

paulmelnikow
paulmelnikow

Reputation: 17208

Sure, you can do this without code:

  1. Add an array controller to your nib.
  2. Bind or connect an outlet for its managed object context
  3. Set the array controller to Entity mode, fill in the entity name, and select Prepares Content.
  4. Bind your table view columns to array controller's arranged objects, and fill in the key name for the model key.

Regarding the query editor, open up the model, and on the Editor menu click Add Fetch Request.

Upvotes: 3

Related Questions