标签: macos scroll nstextview
如何以编程方式将NSTextView滚动到光标位置?
NSTextView
答案 0 :(得分:1)
这应该有效
NSUInteger cursorPosition; cursorPosition = [[[self.textView selectedRanges] firstObject] rangeValue].location; [self.textView scrollRangeToVisible:NSMakeRange(cursorPosition, 0)];