Working on the settings page of the application I’m developing at work I stumbled across a rather annoying characteristic of NSScrollViews. The NSScrollView allows you to fit a larger custom view into a smaller view which the user then can scroll up/down/left/right to see all the content in the custom view. For our application we need more space to fit all the settings and so I put the controls into an NSScrollView. The problem that occurs is that when you load the page with the NSScrollView it starts at the bottom-left of the custom view inside. This is pretty irritating, every implementation you see of a scroll view starts at the top left – it’s what everyone expects.
So off to google and Stack Overflow I go, apparently this a very frequently brought up question and as such there’s a solution: flip the view. However, this has rather unfortunate consequences for the poor developer (me!) and an awful lot of the mailing lists and posts I’ve read on the subject seem to suggest that we have to man up and get on with it. I find this rather odd, because the solution I’ve come up with is stupidly simple and I cannot be the only one to figure it out. Read on for an example of the problem and my solution.
