I'd like to have the same behavior of special items as it's done in the Things application. I mean Logbook and Trash items in the bottom part of the Sidebar:
Logbook and Trash items are in the most bottom http://tinyurl.com/lhctza
Please advise any way to implement the same functionality in the sidebar tree.
I feel that special ‘spacer’ tree item should be used together with outlineView:heightOfRowByItem:
method.
However, I can't find how to calculate the total height of all visible items (incl. space between groups).
I've decided to hardcode the solution by adding 8 pixels of height for every root item in group style. So, the code looks like this:
- (CGFloat)outlineView:(NSOutlineView *)ov heightOfRowByItem:(id)item;
{
if (![item isSpacer]) return [ov rowHeight];
static const CGFloat ADDITIONAL_SPACE = 8.0f;
NSUInteger numberOfRootGroups = 2;
CGFloat heightOfRows = [ov rowHeight] * ([ov rowForItem:item] + 1)
+ ADDITIONAL_SPACE * numberOfRootGroups;
CGFloat heightOfSidebar = [[ov superview] frame].size.height;
return MAX(0.0f, heightOfSidebar - heightOfRows);
}
Thanks to everybody for support!