Re: core data - beyond the simple example
Re: core data - beyond the simple example
- Subject: Re: core data - beyond the simple example
- From: "I. Savant" <email@hidden>
- Date: Fri, 4 Apr 2008 12:36:12 -0400
> Hm ...OK ...I just know there is a collection of data objects stored
> through core data that I can make accessible through the bindings.
But the "devil is in the details" as they say. Ignoring (or "not
caring") about this *will* get you into trouble.
> Again me not being precise enough. So IIUC the NSTableView has
> NSTableColumns which have NSTableCells. I would have assumed that
> NSTableCells is also a view - which is why I talked about views. Right now
> the cell is a NSTextFieldCell. I somehow need to replace that with something
> bigger. Something that can have multiple controls that I then can bind to
> the other attributes.
Incorrect. A cell is a cell. A view is a view.
http://developer.apple.com/documentation/Cocoa/Conceptual/ControlCell/Concepts/AboutControlsCells.html
Replacing a data cell for a column (for the basic cells) is easy.
Building a table view whose cells actually use views is not. To get
you started:
http://www.stepwise.com/Articles/Technical/2003-12-20.01.html
... this is nontrivial. Doubly-so when Bindings is thrown into the
mix. You're in for a world of hurt with your current level of
understanding, but good luck. :-)
> Just think of something along the lines of
>
> @interface MyObject : NSObject
> {
> NSString *name;
> NSString *color;
>
> }
In this case, as I said, just do it the easier way first so you
understand what's involved. Then if you want a 'subview as a cell in a
table', you'll have a much easier time. To do it the simple way,
you'll need to make the necessary adjustments for your color column in
code.
1 - Subclass NSCell (probably NSImageCell would be easiest, YMMV) and
get it to draw whatever color is given as its value.
2 - Obtain a reference to your "color" column and set its data cell to
your NSCell subclass (like "MyColorCell".
More may be needed, but I'm busy and this is as much thought as I've
put into it.
> It's really more about getting more values into the one NSTableCell.
Simple, huh? Except that with the approach you're taking, not so much. ;-)
With respect, you're biting off way more than you have the teeth to
chew at the moment. It's not just a Core Data thing as your subject
line suggests. You're actually missing a few very critical
prerequisite topics:
1 - How views(controls) and cells work.
2 - How to configure a table view (to use custom cells).
3 - POTENTIALLY how to intermix bindings and table data source methods
(for custom cells).
4 - Bindings (and probably the required KVC/KVO concepts).
5 - NSController/NSArrayController specifics (such as how to filter
here, as well as the fact that 'here' is 'where' you filter).
> The actual implementation does not really matter. But seems like building
> up a NSPredicate (by basically parsing the input) and then again setting
> that on the array controller should be it.
Correct.
--
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