View-based NSOutlineView header cell font issues

前端 未结 2 1476
耶瑟儿~
耶瑟儿~ 2021-02-09 23:39

I\'m currently trying to use a new view-based NSOutlineView in my Cocoa app. As I\'m not using bindings, so I implemented all required delegate and datasource methods in my cont

相关标签:
2条回答
  • 2021-02-10 00:34

    You need to implement the -outlineView:isGroupItem: delegate method and return YES for your header rows. That will standardize the font and replace the disclosure triangle on the left with a Show/Hide button on the right. You will still need to manually uppercase your string to get the full effect.

    I'm not sure if the group row delegate method above makes the selection style look okay or not. However, you normally don't want the header rows to be selectable at all in source lists, which you by returning NO for header items from the -outlineView:shouldSelectItem: delegate method.

    0 讨论(0)
  • 2021-02-10 00:39

    I have created a little sample project which includes a source list and also uses the -outlineView:isGroupItem: method as @boaz-stuller has suggested.

    • 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)
提交回复
热议问题