NSScrollView frame and inverted documentView

I'm having problems with NSScrollView, it doesn't display the way I want. Yes, I know there are a lot of posts on the internet about this, I need to override isFlipped to get it back in my NSView subclass.

So now, my scrollView is scrolling from top to bottom, not the other way around as it was before overriding isFlipped.

But, this is the second part, my real problem that I didn't find an answer on the internet, how the hell am I supposed to code, or create my view in the interface builder if everything is reversed? If I put something at the top, it displays at the bottom ... do you have any magic trick to deal with this?

And my last problem is the NSScrollView frame. before setting the documentView of my scrollview everything is fine, the scrollView is displayed in the location you selected, but when I set the documentview it looks like the scrollview frame looks larger, so I need to resize it .... is this normal behavior?

Many thanks.

+2


a source to share


2 answers


The answer is usually to subclass NSClipView that returns YES from the isFlipped override:



Then, in IB, set the scroll content view (clip view) to your subclass.

+3


a source


The inverted function applies its coordinate system to that exact view, not to the entire view hierarchy. That way, no matter what you do right in your content view, you need to know that it flipped, but does nothing else.

And if you don't want it to work this way, just don't ask it to roll over! There's no rule that says NSScrollView document view has , it's just very common for anything with variable height content to be laid out top to bottom, which is easiest to do in an inverted view. If the layout you are making works best as an anchored from the bottom, be sure to hold it without moving, whichever is easier. (And whatever you want in Interface Builder should be anyway ... have you actually seen this problem, or are you just suggesting it might happen? I've never seen this problem ...)



The document view setting should not resize the NSScrollView. You may have something else besides that ...

0


a source







All Articles