Pregunta

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

¿Fue útil?

Solución

This should work

NSUInteger cursorPosition;
cursorPosition = [[[self.textView selectedRanges] firstObject] rangeValue].location;
[self.textView scrollRangeToVisible:NSMakeRange(cursorPosition, 0)];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top