包含滚动视图的NSTextView在空格键上跳转 [英] NSTextView enclosing scroll view jumps on spacebar

查看:58
本文介绍了包含滚动视图的NSTextView在空格键上跳转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序行为异常,我不知道它来自哪里.我已经为文本视图内容实现了NSScanner,它的效果非常好.扫描程序与文本存储结合使用,以通过文本视图委托方法在文本存储字符串上设置属性.但是,每次我输入一个空格时,封闭的滚动视图都会滚动回到文本视图的顶部.谁能给我提示这是哪里来的?

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 ?

推荐答案

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

Probably not much hassle for those more experienced than me, I found out the possible reason for this behavior (see above) so I post it here in case anyone will look for solutions for similar "problems". It seems that turning off "Non-contiguous layout" option in the XCode 4.x attributes inspector for the NSTextView in case will solve the problem. The documentation for NSLayoutManager provides more clues (under "Overview" section): "Noncontiguous layout is an optional layout manager behavior new in Mac OS X v10.5..."

也许,比我更有经验的人会提供更多信息,并在选中了非连续选项(默认情况下)时,导致滚动滚动器视图出现这种行为的原因.

Maybe somebody more experienced than me will provide more info on this and the reason of this behavior of the enclosing scroller view when non-contiguous option is checked (which is, by default).

这篇关于包含滚动视图的NSTextView在空格键上跳转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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