我有一个带有大量文本的 NSTextView。 然而,每当我滚动时,视图都不会正确更新。 有一些工件保留在视图的顶部或底部。 看来视图本身刷新得不够频繁。 如果我滚动得很慢,视图会正确更新。 如果我向视图添加边框,一切都会完美运行,无边框视图就是有问题的。 以下是屏幕截图的链接:
谢谢
I have a NSTextView with a sizeable quantity of text. Whenever I scroll however, the view isn't updated properly. There are some artifacts that remain at the top or the bottom of the view. It appears that the view doesn't refresh itself often enough. If I scroll very slowly the view updates correctly though. If I add a border to the view everything works perfectly, borderless view is the one that has a problem. Here's a link to a screenshot:
Thanks
发布评论
评论(4)
您是否为
NSScrollView
或NSClipView
设置了setDrawsBackground
和copiesOnScroll
属性?我建议的第一件事是关闭
NSScrollView
的“绘制背景”属性:请注意,这应该在
NSScrollView
上设置,而不是 em> 在嵌入的NSClipView
上。以下摘录自 文档可能相关:
Have you set the
setDrawsBackground
andcopiesOnScroll
propertes for either theNSScrollView
or theNSClipView
?The first thing I would suggest is turning off the "draws background" property of the
NSScrollView
:Note that this should be set on the
NSScrollView
, and not on the embeddedNSClipView
.The following excerpt from the documentation may be relevant:
看起来文本字段甚至不在滚动区域中...您确定没有什么东西与它重叠吗?
Looks like the text field isn't even in the scrolling-area... Are you sure something isnt overlapping it?
我遇到了类似的麻烦 - 当 NSTextView 嵌入到另一个滚动视图(即 NSTableView)中时,会出现工件。
实际上,我打开 setdrawsbackground,然后添加一个漂亮的颜色以使其再次消失。
这与scrollWheel事件相结合让我可以在NSTableView中使用NSTextView。
I had a similar trouble - artifacts develop when the NSTextView is embedded in another scrollview (ie. a NSTableView).
I actually turned on the setdrawsbackground, and then added a nice color to make it disappear again.
This in combination with a scrollWheel event let me use the NSTextView in a NSTableView.
前段时间我也遇到过同样的麻烦。 我不记得我是怎么解决的。
如果超级视图是自定义视图,请尝试将 NSTextView 放置到另一个视图。 只是为了看看会发生什么。
I had the same trouble some time ago. I don't remember how I solved it.
Try to place the NSTextView to another view if the superview is a custom view. Just to see what will happen.