1

I have an odd behavior with my app and I don't know where it comes from. I have implemented a NSScanner for a text view content that works very well. The scanner works in conjunction with the text storage to set attributes on the text storage string via text view delegate methods. However, each time I enter a space, the enclosing scroll view scrolls back to the top of the text view. Can anyone give me a hint where this comes from ?

4

2 回答 2

4

对于那些比我更有经验的人来说可能没有太多麻烦,我发现了这种行为的可能原因(见上文)所以我在这里发布它以防有人会寻找类似“问题”的解决方案。似乎在 NSTextView 的 XCode 4.x 属性检查器中关闭“非连续布局”选项可以解决问题。NSLayoutManager 的文档提供了更多线索(在“概述”部分下):“非连续布局是 Mac OS X v10.5 中新增的可选布局管理器行为......”

也许比我更有经验的人会在选中非连续选项(默认情况下)时提供有关此内容的更多信息以及封闭滚动视图的这种行为的原因。

于 2011-07-25T11:37:15.927 回答
1

我遇到了同样的问题,关闭“非连续布局”确实解决了这个问题,但它引发了另一个问题,即 NSTextView 对于 10k 行文本变得迟缓。一个类似的问题得到了不同的回答,但我想知道它是否有效。该解决方案还施加了一些可能不适用于您的限制。

于 2011-12-29T09:40:54.773 回答