Re: Opening a window in Core Data application
Re: Opening a window in Core Data application
- Subject: Re: Opening a window in Core Data application
- From: Joshua Scott Emmons <email@hidden>
- Date: Thu, 30 Mar 2006 15:42:22 -0600
That's been pointed out to me - I don't think I understand the MVC
pattern (or design patterns for that matter :(), but I'm starting
to understand that my data model shouldn't know anything about the
windows or views that manage it. Is that roughly right ?
Yup. To flesh it out a little, MVC is your Model, your View, and your
Controller. Model, in this case, being your managed object model set
up with Core Data. Your view being your tables, buttons, text fields,
and other things that interact with the user. The controller(s) are
all the things that "glue" the View and the Model together.
The key is that the View should know nothing about the Controller or
the Model, and the Model should know nothing about the Controller or
the View. This helps clarity, reusability, and (in the long run) sanity.
See http://tinyurl.com/kpk9a for the hows and whys. In particular, I
think this: http://tinyurl.com/f4pzm is worth a thousand words.
Ok - that sounds workable. Sorry to be a total luser, but can you
point me at some documentation / code that discusses accessing
array controllers from your main controller (Alexandria_AppDelegate
in my case?)
I keep it simple. Make an outlet and connect your array controller to
it. If you're still confused about outlets and connecting them in IB,
you really need to hit some of the remedial Cocoa documentation and
examples. I'm not trying to be dismissive, it's just that it's a
basic concept that is covered in a lot of the early docs and isn't
really spelled out anywhere (that I can remember).
I guess that's a usability issue and I'm trying to shake some Linux
coding habits here, so please LART me if I'm doing wrong.
Taking a gander at the HIG (http://tinyurl.com/6dcmm) would probably
resolve these questions in a canonical way. But to talk from my
experience with Mac apps, what would normally happen is that
important (frequently read or edited) data would be displayed in the
table. These fields would all be editable, so that the user can edit
them in place without having to open a new/cluttered/confusing
interface. To provide access to the complete range of parameters
(which may or may not be displayed in the table), an inspector panel
can be opened by button or key combination.
Think of iTunes. One big table displays popular parameters (song
title, my rating, album name...). The rest (Composer, Disc Number,
Equalizer Preset...) can be accessed by going to File->Get Info.
If for some reason, you have data that's hard to fit into a table or
inspector (large images, graphs, sound clips, whatever), you might
want to look at a master-detail intervace. It takes a little more
space than just a table, but it can be made to be collapsable (click
on the disclosure triangle, and the detail-interface expands, for
example). http://tinyurl.com/ljxxc gives a pretty good over view of
using M/D interfaces with core data.
Cheers,
-Joshua Emmons
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden