On Sep 11, 2012, at 10:13 , Chuck Soper <chu...@veladg.com> wrote:

> When adding additional colors, I understand that the following code can
> create a color object, but I'm not sure where to put this code or if I can
> use bindings instead.
> NSManagedObject *color = [NSEntityDescription
> insertNewObjectForEntityForName:@"Color"
>    inManagedObjectContext:self.managedObjectContext];
> [color setValue:@"Dark Blue" forKey:@"name"];

Where you put this code will depend on what triggers creation of the color 
object. If, for example, there's a button that's clicked to create a color, 
then you'd probably have an action method in a controller (e.g. window 
controller, view controller or app delegate) that's responsible for creating 
the new color object. This might contain the above code, or if it's a bit more 
complicated it might call a data-model method that creates the color object 
with all its properties set properly.

> Essentially, I want each "color" object to be a bindable custom view.
> Ideally, this custom view would be a NSTableCellView subclass. My table
> would always have a single row, so I misspoke when I described that as a
> column. I'm not sure how I create and remove this view when creating and
> removing color objects.

I'm not sure what you mean by "a single row" here. The table only ever has one 
row? Or are you saying there should be multiple color subviews in each row?

Perhaps it would be clearer if you asked the whole question again -- I'm a 
little unsure what you're asking.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to