I have an NSScrollView
in which I wish to display several NSTextViews
as shown below. (Much like here and here). I am adding all the different NSTextViews
to an NSView
using addSubView()
, and then assigning the resulting view as the NSScrollView
's documentView
. This is working just fine. However, the NSScrollView
does not scroll properly. When I run the app, I can scroll up and the NSScrollView
will push up and back according to its elasticity, but I cannot scroll down. Sometimes, however, and I'm not entirely sure under what circumstances, I can scroll down. I think it has to do with whether I have focused the NSScrollView
or one of the various NSTextViews
, but I'm not sure. And, to make matters worse, when I have managed to scroll down to the bottom, I start to have the opposite problem: I can push the NSScrollView
down, but not up.
I think this issue has something to do with the fact that I have subclassed NSScrollView
. When I built this same setup using an NSScrollView
as provided by IB
, everything is fine. However, when I subclass NSScrollView
in order to make positioning the NSTextViews
easier, the scrolling functionality becomes all whacky. Can anyone point out why subclassing NSScrollView
makes this happen and what I can do about it?