• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: tableview, button with view and bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tableview, button with view and bindings


  • Subject: Re: tableview, button with view and bindings
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 30 Jun 2011 23:44:27 -0700

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

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >tableview, button with view and bindings (From: R <email@hidden>)

  • Prev by Date: Re: tableview, button with view and bindings
  • Next by Date: Re: How to get the applicaiton name that loads bundle
  • Previous by thread: Re: tableview, button with view and bindings
  • Next by thread: How to get the applicaiton name that loads bundle
  • Index(es):
    • Date
    • Thread