I have an NSTextView control object wrapped with NSScrollView. What I want to do is to make the text string at the current position visible when it's hidden below the content view.
In reference to the picture above, with
NSUInteger cPosition = [[[textView1 selectedRanges] objectAtIndex:0] rangeValue].location;
[textView1 scrollRangeToVisible:NSMakeRange(0,cPosition)];
the scroll view will scroll itself to a position such that the selected string (document) will come at the bottom of the content view. (Line 11). That's not exactly what I want. I would like the scroll view to scroll itself to show the text string at the current cursor position when it's hidden below the content view (for example, at Line 14). How can I improve my code?
Muchos thankos.
