質問

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