Re: tableview, button with view and bindings
Re: tableview, button with view and bindings
- Subject: Re: tableview, button with view and bindings
- From: R <email@hidden>
- Date: Fri, 01 Jul 2011 07:33:13 -0700 (PDT)
throwing exceptions when the binding controller key is
"arrangeObjects". Note that all other data is using arrangedObjects
fine. But, placing an image on the button with this config is
failing.
I can get an image to display using the "selection" controller key.
But of course the wrong image will display when changing rows.
On Jul 1, 12:44 am, Quincey Morris <email@hidden>
wrote:
> On Jun 30, 2011, at 23:13, R wrote:
>
> > Can anyone give me some guidance on adding a button w/ image to a
> > tableview using bindings. I've had good luck adding buttons to a
> > tableview by dropping in a button cell. But adding the image is
> > giving me some problems. The image will be retrieved from the object
> > represented on the row of the tableview. I'm populating the content
> > array and tableview via an arrayController.
>
> In IB, drill down to the level of the button cell -- either keep clicking on the top row of the column in the layout view until just the cell is selected, or select the cell directly in the outline view. Once the cell is selected, you should see the "Image" and "Alternate Image" bindings in the Bindings inspector. Bind the one(s) that you want to a NSImage property of arrangedObjects, and that should be all you need to do.
>
> Alternately, you can do this programmatically by implementing the tableView:willDisplayCell:forTableColumn:row: delegate method. After matching on the row, column and (for robustness) cell class, just set the cell's image to the desired image. I guess this doesn't meet your "using bindings" requirement, but sometimes it's easier to do it this way than to derive a KVO-compliant image property to use with bindings.
>
> _______________________________________________
>
> 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
>
>
> This email sent to email@hidden
_______________________________________________
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