tlineView中显示不确定的NSProgressIndica

tlineView中显示不确定的NSProgressIndica

本文介绍了如何在NSOutlineView中显示不确定的NSProgressIndicator?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我需要显示加载项目的子项的进度。请建议如何在邮件应用程序中实现进度指示器:

I need to display a progress of loading of item's children. Please advise how to implement a progress indicator like it's done in Mail application:

P。 S.这里使用指标子视图的源代码:

P. S. Here a source code of using indicator sub-views: http://snippets.dzone.com/posts/show/7684

推荐答案

这比它应该更难,因为苹果没有提供NSProgressIndicatorCell 。虽然表和大纲视图支持在其中显示自定义单元格的想法,但它们没有设置为轻松支持自定义子视图。

This is harder than it should be, because Apple does not provide an NSProgressIndicatorCell. While table and outline views support the idea of custom cells being displayed within them, they are not set up to easily support custom subviews.

因此,诀窍就变成了,如何获得一个完整的NSProgressIndicator视图,以便在窗口中的所需位置显示和动画化,而无法在表中实际安装查看行?

So the trick becomes, how do you get a a complete NSProgressIndicator view to display and animate at the desired spot in your window, without the ability to actually install it in the table view row?

我使用的技巧是将NSProgressIndicator实际安装为大纲或表视图本身的子视图。要找到添加子视图的位置,因此看起来像是在行中,请使用frameOfCellAtColumn:row:方法。然后,您可以将进度指示器放置在大纲视图的该位置。当你完成旋转进度指示器,你可能不想再显示它,所以只要从它的超级视图中删除它并丢弃它。

The trick I've used is to literally install the NSProgressIndicator as a subview of the outline or table view itself. To find the location to add the subview, so it looks like it's "in the row", use the frameOfCellAtColumn:row: method. You can then position your progress indicator within that location of the outline view. When you're done spinning the progress indicator, you probably don't want to show it any more, so just remove it from its superview and discard it.

想要确保您在进度指示器上设置所需的自动调整标记,以便在/您的大纲视图大小调整时,以正确的方向浮动。

You will want to make sure you set the required autosizing flags on the progress indicator, so that it floats in the correct direction when/if your outline view is resized.

肯定有其他类似这样的hack实现所需的最终结果。我不认为有任何超级干净的方式来完成这个伎俩。

I'm sure there are other hacks like this to achieve the desired end result. I don't think there is any super-clean way to accomplish this trick.

这篇关于如何在NSOutlineView中显示不确定的NSProgressIndicator?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:10