Вопрос

How can I make programmatically an NSTextView scroll to the cursor position?

Это было полезно?

Решение

This should work

NSUInteger cursorPosition;
cursorPosition = [[[self.textView selectedRanges] firstObject] rangeValue].location;
[self.textView scrollRangeToVisible:NSMakeRange(cursorPosition, 0)];
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top