Adding custom subviews to NSOutlineView with source list style
I'd like to add some controls above the contents of an NSOutlineView
that has NSTableViewSelectionHighlightStyleSourceList
set so that it looks like a Finder/iTunes/iPhoto-like source list. The controls I want to add should therefore be placed above the whole source list, but in the same NSScrollView
as the outline view. The color behind them should also be that of the source lis (which is spec开发者_开发知识库ial because it changes from light blue to grey when the window loses focus).
I already tried to move the NSOutlineView
down programmatically inside its parent views (which are a NSClipView
and then an NSScrollView
), but changing the NSOutlineView
s frame doesn't work (the frame isn't changed at all).
Cheers
MrMage
What you're describing -- controls sharing the background color of a source list but higher than (above, not on-top of) the content -- is not at all similar to Finder or iTunes. They put controls in the window's toolbar space. In fact, what you describe sounds like a poor UI decision entirely.
That said, you could probably achieve your stated goal by adding one or more rows of "empty content" i.e. return nil
from outlineView:objectValueForTableColumn:byItem:
and possibly set custom row height with outlineView:heightOfRowByItem:
and then add your subviews onto that "empty" space.
精彩评论