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:18:19 -0700 (PDT)
Thanks. I'm currently displaying an image with success. I want to
use a button and an image instead. I did what you said and am covered
up with errors. Will dig deeper.
Much thanks
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