简体   繁体   English

有没有一种方法可以移动NSTextView的指示器?

[英]Is there a way to move NSTextView 's indicator around?

This is about Cocoa (OSX) TextViews 这是关于可可(OSX)TextViews的

You know that blinking line which hints the position where the next character will be inserted? 您知道那条闪烁的线暗示了下一个字符将插入的位置吗? How to move that inside programmatically? 如何以编程方式在内部移动它? I just want to animate typing. 我只想动画输入。

I read about 我读到

- (void)insertText:(id)aString
  replacementRange:(NSRange)replacementRange

Is there a way I could use that to simulate the above? 有没有一种方法可以用来模拟以上内容?

Otherwise, Can I simulate the back arrow key? 否则,我可以模拟后退箭头键吗? If so, how? 如果是这样,怎么办?

textView.setSelectedRange(NSRange(location: 5,length: 0))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM