• 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: NSOutlineView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView


  • Subject: Re: NSOutlineView
  • From: Charles Jenkins <email@hidden>
  • Date: Mon, 08 Sep 2014 19:00:05 -0400

Ken,

Thanks for trying to help me out. I tried to follow your advice, but I must not have completely understood it.

I changed the relevant method to this:

  func outlineView(
    _outlineView: NSOutlineView!,
    objectValueForTableColumn tableColumn: NSTableColumn!,
    byItem item: AnyObject!
    ) -> AnyObject!
  {
    let node = getDocumentNodeFrom( item )
    return node
  }


And in the particular NSTextFieldCell, I made sure “Bind to Table Cell View” was checked, and I set the model key path to objectValue.title. I’d love to attach a screenshot of what I’ve done in Xcode, but I haven’t been able to make a JPEG small enough to get past the mailing list’s 25K limit.

In case it matters, here’s part of the declaration of DocumentNode:

  import Foundation

  class DocumentNode : NSObject {

    var title: String
    var content: NSAttributedString
    var children: [DocumentNode]


When I run my program, the outline view still shows disclosure triangles but no titles for the text view cells.

--

Charles Jenkins

On Saturday, September 6, 2014 at 13:42, Ken Thomases wrote:
>
> Depending on your model, you may actually find it's better to have your data source return a "compound" model object and then bind the text field to just a specific property of that model object. So, your data source method could return the "node" and the text field could bind to objectValue.title. This approach allows you to add another view (say, an image view) and bind it to a different property of the object that's represented by the row. It also allows the text field to be editable and directly modify the model object by setting its title property (if that's something you want to allow).
>
> Regards,
> Ken


_______________________________________________

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


  • Follow-Ups:
    • Re: NSOutlineView
      • From: Ken Thomases <email@hidden>
    • Re: NSOutlineView
      • From: Quincey Morris <email@hidden>
References: 
 >NSOutlineView (From: Charles Jenkins <email@hidden>)
 >Re: NSOutlineView (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: NSUserDefaultsController in a NIB when not using standardUserDefaults
  • Next by Date: Re: NSOutlineView
  • Previous by thread: Re: NSOutlineView
  • Next by thread: Re: NSOutlineView
  • Index(es):
    • Date
    • Thread