Re: CoreData without bindings
Re: CoreData without bindings
- Subject: Re: CoreData without bindings
- From: "I. Savant" <email@hidden>
- Date: Thu, 23 Aug 2007 11:44:46 -0400
On 8/23/07, Luc Vandal <email@hidden> wrote:
> Well, the thing is that I have a NSTableView that will display
> several types of data. For example, it could display only items bound
> to a certain group but could also display items ordered by groups
> (where you'd display the group and it's items undeneath, then another
> group and so on). I would also have a NSOutlineView that would not
> only display data like in the NSTableView, but also other non-data
> items, such as a trash item.
Okay, so the tried-and-true <NSTableDataSource> and NSTableView (and
related outline) methods are probably easiest. To react to changes to
the context, register for
NSManagedObjectContextObjectsDidChangeNotification and refresh your
table/outline accordingly.
Your data source, essentially, will take care of fetching, etc. and
providing the correct data. Be advised, however, that you'll want to
do some sort of caching each time you -reloadData since the data
source methods will be called many times in rapid succession. You're
likely not to want to fetch each time ...
> Since it's my first Core Data application, I have a hard time
> figuring out how I could achieve this with bindings since my
> understanding is that the binding would have to change depending on
> the data I want to display in the views.
Not necessarily. It's perfectly fine (and sometimes/often necessary)
to mix bindings and table data source / delegate methods to get the
desired results. You can use a mix of manual bindings to react to
changes in columns (adding / removing / whatever) *you* are in charge
of what data the controller gives, so you can always abstract. A car
and a bicycle, for example, are both vehicles ... both have traits
common to wheeled transportation ... ;-)
--
I.S.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden