Strange behavior using view-based NSOutline (Sourcelist)

后端 未结 4 1752
终归单人心
终归单人心 2021-01-30 11:39

I have a (new in Lion) view-based NSOutlineView as Sidebar SourceList in my app using CoreData + NSTreeController + Bindings + NSOutlineView and an Object as NSOutlineViewDelega

相关标签:
4条回答
  • 2021-01-30 12:10

    In case it's not obvious to anyone:

    "Floats group rows" in Interface Builder:

    You can set "Floats group rows" directly in Interface Builder.

    1. select your Source List in Interface Builder's document outline.

    2. show the Attributes Inspector, and you will find the "Floats Group Rows" checkbox. Untick it, and your nasty jumping group headings suddenly behave themselves :)

    In Swift:

    Alternatively, if you're in Swift, you can do something like:

    @IBOutlet weak var sourceList: NSOutlineView!    
    sourceList.floatsGroupRows = false
    
    0 讨论(0)
  • 2021-01-30 12:31

    Setting setFloatsGroupRows:NO for the outline view must solve the issue with first group item moving up-down when being expanded/collapsed.

    0 讨论(0)
  • 2021-01-30 12:32

    You may also have a look at the answer of this question: NSOulineView header cell font The automatic style unselect-reselect dance worked for me.

    0 讨论(0)
  • 2021-01-30 12:34

    I was wondering how you achieved the source list that's visible on the screenshot.

    I have created a little sample project, which does the same and includes the feedback from @anton-ivanov:

    • Display a list of items
    • Edit the items in a master-detail fashion
    • Remove and add items
    • Usage of bindings

    Check out besi/mac-quickies on github. Most of the stuff is either done in IB or can be found in the AppDelegate

    screenshot

    0 讨论(0)
提交回复
热议问题