如何将 NSOutlineView 的最后一个树项保留在侧边栏的最底部?
我希望特殊项目具有与 Things 应用程序中相同的行为。我的意思是侧边栏底部的日志和垃圾箱项目:
日志和垃圾箱项目位于最底部 http://tinyurl.com/lhctza
请告知在侧边栏树中实现相同功能的任何方法。
我觉得特殊的“spacer”树项应该与outlineView:heightOfRowByItem:方法一起使用。
但是,我找不到如何计算所有可见项目的总高度(包括组之间的空间)。
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试简单地使用两个轮廓视图:一个具有固定高度,固定在其超级视图的底部,另一个具有可变高度,其底部紧邻第一个视图的顶部。固定高度大纲视图将包含日志和垃圾箱项目,可变高度大纲视图将包含所有其他项目。
棘手的部分是通过滚动视图使这个游戏变得更好,但我认为你可以做到。我想你会把它们放在一个完全可调整大小的 NSView 中,并使其成为滚动视图的文档视图。
You might try simply having two outline views: One of fixed height, pinned to the bottom of their superview, and the other of variable height, with its bottom immediately above the top of the first. The fixed-height outline view would contain those Logbook and Trash items, and the variable-height outline view would contain all the others.
The tricky part would be making this play nice with a scroll view, but I think you could do it. I imagine you'd put them both in a fully-resizable NSView and make that the scroll view's document view.
我决定通过为组样式中的每个根项添加 8 个像素的高度来硬编码该解决方案。
所以,代码如下:
感谢大家的支持!
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:
Thanks to everybody for support!