NSTableView重绘不更新显示,选择粘贴 [英] NSTableView redraw not updating display, selection sticking

查看:523
本文介绍了NSTableView重绘不更新显示,选择粘贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我知道这个问题的解决方案,我有兴趣,如果有人可以解释这个解决方案给我。我也想得到这里,因为我找不到任何提到这个问题在线,和我花了几个小时几天跟踪。我有一个NSTableView行为奇怪的重绘和它的选择。问题如下所示:

Although I know of a solution to this problem, I am interested if someone can explain this solution to me. I also wanted to get this out there because I could not find any mention of this problem online, and it took me several hours over several days to track down. I have an NSTableView behaving strangely regarding redraws and its selection. The problem looks like this:

表内容淡入,而不是立即出现在屏幕上。当滚动内容时,新出现的行也会淡入。当您进行选择(单个或多个),并将其从屏幕上滚动,然后进行另一个选择(应替换,不添加到第一个选择),第一个选择无法正确清除。如果你滚动到它,它仍然在那里,除了你的新选择。这是一个显示更新问题,而不是选择问题 - 即您的新选择是有效的,它只是显示错误。

Table contents fades in, instead of appearing instantly upon it's appearance on screen. When scrolling through the contents, the newly appearing rows also fade in. When you make a selection (single or multiple), and scroll it off screen, then make another selection (that should replace, not add-to first selection), the first selection does not get cleared properly. If you scroll back to it, it is still there, in addition to your new selection. This is a display-update problem, not selection problem - i.e. your new selection is valid, it is just displayed wrong.

我通过NSArrayController跟踪这是我绑定,底层的数组,排序,所有的连接和设置等,但所有这一切与它无关。

I tracked this through the NSArrayController I was binding to, the underlying Array, sorting, all the connections, and settings, etc., but all that has nothing to do with it.

解决问题是:
在视图效果(最右边)检查器中,取消选中窗口主视图的核心动画层。

What solved the problem was: In the View Effects (right-most) Inspector, uncheck "Core Animation Layer" for the Window's main view.

任何人都可以解释这里发生的事,改进解决方案?

Can anyone explain what is happening here, and perhaps improve upon the solution ?

推荐答案

看起来像Core Animation和 NSTableView 不是那么好。 褪色效果是核心动画工作方式的副产品。当你在一个视图中有核心动画时,它也在所有视图的子视图中启用。

It looks like Core Animation and NSTableView aren't getting along so well. The "fading" effect is a by-product of the way core animation works. When you have core animation in one view, it is also enabled in all of that view's subviews.

我不建议在Mac上使用核心动画,除非绝对必要,因为一些界面元素(例如 NSTextView NSTableView )与它不兼容。 iOS对表视图和使用核心动画的更好的支持,主要是因为它设计了核心动画。

I don't recommend using core animation on the Mac unless absolutely necessary, because some interface elements (NSTextView and NSTableView, for example) aren't compatible with it. iOS has much better support for table views and such using core animation, mainly because it was designed with core animation in mind.

我知道一些更简单的UI元素是兼容的( NSTextField NSButton )。

I know that some more simple UI elements are compatible (NSTextField and NSButton, for example).

如果你绝对需要核心动画在窗口的其余部分,将所有其他视图在内容视图的子视图,而直接在内容视图中保留表视图。然后,您可以在其他视图中启用核心动画。

If you absolutely need core animation in the rest of the window, put all the other views in a subview of the content view, while leaving the table view directly in the content view. You can then enable Core Animation in the other view.

注释者可随意添加到列表中,并且不兼容。

Commenters, feel free to add to the list of what is and isn't compatible.

这篇关于NSTableView重绘不更新显示,选择粘贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆