Re: binding an array controller to columns in an NSTableView
Re: binding an array controller to columns in an NSTableView
- Subject: Re: binding an array controller to columns in an NSTableView
- From: Chuck Soper <email@hidden>
- Date: Tue, 11 Sep 2012 15:54:43 -0700
- Thread-topic: binding an array controller to columns in an NSTableView
On 9/11/12 11:23 AM, "Quincey Morris"
<email@hidden> wrote:
>On Sep 11, 2012, at 10:13 , Chuck Soper <email@hidden> 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.
Thanks. That helps. In hindsight, saying that I could use an action method
in a controller suddenly seems obvious. Recently, I connected an Add
button's action directly to the add: method in an NSArrayController. Of
course, I could also connect the Add button's action to an action method
in a controller (view, window, app delegate) and do what I need there.
>
>> 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?
Another way to put this is: I want a horizontally scrolling list of custom
views, where each view is associated with a color object (for my core data
Color entity).
>Perhaps it would be clearer if you asked the whole question again -- I'm
>a little unsure what you're asking.
Yes, I agree. Good idea. The question has changed. I'll do that now. The
new question is titled "associating a custom view for each object in a
core data entity." Hopefully, it's a little more to the point.
Chuck
_______________________________________________
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